Skip to content
Permalink
Browse files

Fix updating gui after undoing layout settings change

  • Loading branch information
nyalldawson committed Dec 11, 2017
1 parent 2e68dd7 commit 94b63d17b726eee9d715502fcc3de958457f73a8
@@ -541,6 +541,13 @@ Updates the scene bounds of the layout.

signals:

void changed();
%Docstring
Is emitted when properties of the layout change. This signal is only
emitted for settings directly managed by the layout, and is not emitted
when child items change.
%End

void variablesChanged();
%Docstring
Emitted whenever the expression variables stored in the layout have been changed.
@@ -74,7 +74,14 @@ QgsLayoutPropertiesWidget::QgsLayoutPropertiesWidget( QWidget *parent, QgsLayout
connect( mReferenceMapComboBox, &QgsLayoutItemComboBox::itemChanged, this, &QgsLayoutPropertiesWidget::referenceMapChanged );

mReferenceMapComboBox->setCurrentLayout( mLayout );
mReferenceMapComboBox->setItem( mLayout->referenceMap() );

connect( mLayout, &QgsLayout::changed, this, &QgsLayoutPropertiesWidget::updateGui );
updateGui();
}

void QgsLayoutPropertiesWidget::updateGui()
{
whileBlocking( mReferenceMapComboBox )->setItem( mLayout->referenceMap() );
}

void QgsLayoutPropertiesWidget::updateSnappingElements()
@@ -30,6 +30,8 @@ class QgsLayoutPropertiesWidget: public QgsPanelWidget, private Ui::QgsLayoutWid

private slots:

void updateGui();

void gridResolutionChanged( double d );
void gridResolutionUnitsChanged( QgsUnitTypes::LayoutUnit unit );
void gridOffsetXChanged( double d );
@@ -624,7 +624,7 @@ class QgsLayoutUndoCommand: public QgsAbstractLayoutUndoCommand
return;
}

mLayout->readXmlLayoutSettings( stateDoc.documentElement().firstChild().toElement(), stateDoc, QgsReadWriteContext() );
mLayout->readXmlLayoutSettings( stateDoc.documentElement(), stateDoc, QgsReadWriteContext() );
mLayout->project()->setDirty( true );
}

@@ -753,6 +753,7 @@ bool QgsLayout::readXmlLayoutSettings( const QDomElement &layoutElement, const Q
setName( layoutElement.attribute( QStringLiteral( "name" ) ) );
setUnits( QgsUnitTypes::decodeLayoutUnit( layoutElement.attribute( QStringLiteral( "units" ) ) ) );
mWorldFileMapId = layoutElement.attribute( QStringLiteral( "worldFileMap" ) );
emit changed();

return true;
}
@@ -848,13 +849,17 @@ bool QgsLayout::readXml( const QDomElement &layoutElement, const QDomDocument &d
return object->readXml( layoutElement, document, context );
};

blockSignals( true ); // defer changed signal to end
readXmlLayoutSettings( layoutElement, document, context );
blockSignals( false );

restore( mPageCollection.get() );
restore( &mSnapper );
restore( &mGridSettings );
addItemsFromXml( layoutElement, document, context );

emit changed();

return true;
}

@@ -582,6 +582,13 @@ class CORE_EXPORT QgsLayout : public QGraphicsScene, public QgsExpressionContext

signals:

/**
* Is emitted when properties of the layout change. This signal is only
* emitted for settings directly managed by the layout, and is not emitted
* when child items change.
*/
void changed();

/**
* Emitted whenever the expression variables stored in the layout have been changed.
*/

0 comments on commit 94b63d1

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