mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[layouts] Fix loss of composition variables when converting 2.x compositions
This commit is contained in:
parent
cabcce1fcd
commit
83340d0dfb
@ -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 );
|
||||
|
||||
|
11
tests/testdata/layouts/sample_project.qgs
vendored
11
tests/testdata/layouts/sample_project.qgs
vendored
@ -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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user