Skip to content

Commit

Permalink
[layouts] Correctly restore dpi from 2.x compositions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 31, 2018
1 parent 1194c78 commit 6ec4d08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/layout/qgscompositionconverter.cpp
Expand Up @@ -128,6 +128,9 @@ std::unique_ptr< QgsPrintLayout > QgsCompositionConverter::createLayoutFromCompo
// Guides
layout->guides().setVisible( composerElement.attribute( QStringLiteral( "guidesVisible" ), QStringLiteral( "1" ) ).toInt() != 0 );

int printResolution = composerElement.attribute( "printResolution", "300" ).toInt();
layout->renderContext().setDpi( printResolution );

// Create pages
int pages = composerElement.attribute( QStringLiteral( "numPages" ) ).toInt( );
float paperHeight = composerElement.attribute( QStringLiteral( "paperHeight" ) ).toDouble( );
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscompositionconverter.cpp
Expand Up @@ -534,6 +534,7 @@ void TestQgsCompositionConverter::convertComposerTemplate()
QVERIFY( layout );
QCOMPARE( layout->pageCollection()->pageCount(), 2 );
QCOMPARE( layout->name(), QStringLiteral( "composer title" ) );
QCOMPARE( layout->renderContext().dpi(), 305.0 );

// Check guides
QCOMPARE( layout->guides().rowCount( QModelIndex() ), 8 );
Expand Down

0 comments on commit 6ec4d08

Please sign in to comment.