Skip to content

Commit

Permalink
[snapping] fix missing layers in snapping config dialog (fixes #17792) (
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 12, 2018
1 parent f3ced09 commit 9a14e8d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/qgssnappinglayertreemodel.h
Expand Up @@ -72,6 +72,7 @@ class APP_EXPORT QgsSnappingLayerTreeModel : public QSortFilterProxyModel

QgsLayerTreeModel *layerTreeModel() const;
void setLayerTreeModel( QgsLayerTreeModel *layerTreeModel );
void resetLayerTreeModel() { reset(); }

QgsVectorLayer *vectorLayer( const QModelIndex &idx ) const;

Expand Down
4 changes: 4 additions & 0 deletions src/app/qgssnappingwidget.cpp
Expand Up @@ -217,6 +217,10 @@ QgsSnappingWidget::QgsSnappingWidget( QgsProject *project, QgsMapCanvas *canvas,
connect( model, &QgsSnappingLayerTreeModel::rowsInserted, this, &QgsSnappingWidget::onSnappingTreeLayersChanged );
connect( model, &QgsSnappingLayerTreeModel::modelReset, this, &QgsSnappingWidget::onSnappingTreeLayersChanged );
connect( model, &QgsSnappingLayerTreeModel::rowsRemoved, this, &QgsSnappingWidget::onSnappingTreeLayersChanged );
connect( project, &QgsProject::readProject, this, [ = ]
{
model->resetLayerTreeModel();
} );

// model->setFlags( 0 );
mLayerTreeView->setModel( model );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsproject.cpp
Expand Up @@ -1042,7 +1042,6 @@ bool QgsProject::readProjectFile( const QString &filename )
}

mSnappingConfig.readProject( *doc );
emit snappingConfigChanged( mSnappingConfig );

//add variables defined in project file
QStringList variableNames = readListEntry( QStringLiteral( "Variables" ), QStringLiteral( "/variableNames" ) );
Expand All @@ -1066,6 +1065,7 @@ bool QgsProject::readProjectFile( const QString &filename )

// read the project: used by map canvas and legend
emit readProject( *doc );
emit snappingConfigChanged( mSnappingConfig );

// if all went well, we're allegedly in pristine state
if ( clean )
Expand Down

0 comments on commit 9a14e8d

Please sign in to comment.