mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Don't mark project dirty when legend nodes are expanded/collapsed
This commit is contained in:
parent
773ec220ba
commit
40ceb7bdce
@ -148,6 +148,8 @@ Returns list of indicators associated with a particular layer tree node.
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
void refreshLayerSymbology( const QString &layerId );
|
||||
%Docstring
|
||||
|
@ -3238,7 +3238,12 @@ void QgisApp::setupConnections()
|
||||
connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::visibilityChanged,
|
||||
this, &QgisApp::markDirty );
|
||||
connect( mLayerTreeView->layerTreeModel()->rootGroup(), &QgsLayerTreeNode::customPropertyChanged,
|
||||
this, &QgisApp::markDirty );
|
||||
this, [ = ]( QgsLayerTreeNode *, const QString & key )
|
||||
{
|
||||
// only mark dirty for non-view only changes
|
||||
if ( !QgsLayerTreeView::viewOnlyCustomProperties().contains( key ) )
|
||||
QgisApp::markDirty();
|
||||
} );
|
||||
|
||||
// connect map layer registry
|
||||
connect( QgsProject::instance(), &QgsProject::layersAdded,
|
||||
|
@ -355,6 +355,12 @@ QList<QgsLayerTreeViewIndicator *> QgsLayerTreeView::indicators( QgsLayerTreeNod
|
||||
return mIndicators.value( node );
|
||||
}
|
||||
|
||||
///@cond PRIVATE
|
||||
QStringList QgsLayerTreeView::viewOnlyCustomProperties()
|
||||
{
|
||||
return QStringList() << QStringLiteral( "expandedLegendNodes" );
|
||||
}
|
||||
///@endcond
|
||||
|
||||
void QgsLayerTreeView::refreshLayerSymbology( const QString &layerId )
|
||||
{
|
||||
|
@ -135,6 +135,20 @@ class GUI_EXPORT QgsLayerTreeView : public QTreeView
|
||||
*/
|
||||
QList<QgsLayerTreeViewIndicator *> indicators( QgsLayerTreeNode *node ) const;
|
||||
|
||||
///@cond PRIVATE
|
||||
|
||||
/**
|
||||
* Returns a list of custom property keys which are considered as related to view operations
|
||||
* only. E.g. node expanded state.
|
||||
*
|
||||
* Changes to these keys will not mark a project as "dirty" and trigger unsaved changes
|
||||
* warnings.
|
||||
*
|
||||
* \since QGIS 3.2
|
||||
*/
|
||||
static QStringList viewOnlyCustomProperties() SIP_SKIP;
|
||||
///@endcond
|
||||
|
||||
public slots:
|
||||
//! Force refresh of layer symbology. Normally not needed as the changes of layer's renderer are monitored by the model
|
||||
void refreshLayerSymbology( const QString &layerId );
|
||||
|
Loading…
x
Reference in New Issue
Block a user