Skip to content
Permalink
Browse files

[layouts] Fix loss of composition variables when converting 2.x compo…

…sitions

(cherry picked from commit 83340d0)
  • Loading branch information
nyalldawson committed Jan 17, 2019
1 parent 19f0e02 commit 42254b4733c4d01b4d193ddb01c5677067e0f366
@@ -126,6 +126,8 @@ std::unique_ptr< QgsPrintLayout > QgsCompositionConverter::createLayoutFromCompo
std::unique_ptr< QgsPrintLayout > layout = qgis::make_unique< QgsPrintLayout >( project );
layout->undoStack()->blockCommands( true );

layout->mCustomProperties.readXml( composerElement );

// Guides
layout->guides().setVisible( composerElement.attribute( QStringLiteral( "guidesVisible" ), QStringLiteral( "1" ) ).toInt() != 0 );

@@ -558,6 +558,11 @@ void TestQgsCompositionConverter::convertComposition()
QCOMPARE( layout->name(), QStringLiteral( "composer title" ) );
QCOMPARE( layout->renderContext().dpi(), 305.0 );

QStringList variableNames = layout->customProperty( QStringLiteral( "variableNames" ) ).toStringList();
QStringList variableValues = layout->customProperty( QStringLiteral( "variableValues" ) ).toStringList();
QCOMPARE( variableNames, QStringList() << QStringLiteral( "variable1" ) << QStringLiteral( "variable2" ) );
QCOMPARE( variableValues, QStringList() << QStringLiteral( "100" ) << QStringLiteral( "200" ) );

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

@@ -583,7 +583,16 @@
</ComposerFrame>
<customproperties/>
</ComposerAttributeTableV2>
<customproperties/>
<customproperties>
<property key="variableNames">
<value>variable1</value>
<value>variable2</value>
</property>
<property key="variableValues">
<value>100</value>
<value>200</value>
</property>
</customproperties>
</Composition>
</Composer>
<Composer title="composer atlas" visible="0">

0 comments on commit 42254b4

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