Skip to content
Permalink
Browse files

[layouts] Correctly restore dpi from 2.x compositions

  • Loading branch information
nyalldawson committed Jan 31, 2018
1 parent 1194c78 commit 6ec4d082723eef786194c4911c133bf6199ed038
Showing with 4 additions and 0 deletions.
  1. +3 −0 src/core/layout/qgscompositionconverter.cpp
  2. +1 −0 tests/src/core/testqgscompositionconverter.cpp
@@ -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( );
@@ -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 );

0 comments on commit 6ec4d08

Please sign in to comment.
You can’t perform that action at this time.