Skip to content
Permalink
Browse files

[snapping] fix missing layers in snapping config dialog (fixes #17792) (

  • Loading branch information
nirvn committed Jan 12, 2018
1 parent f3ced09 commit 9a14e8dfcbea14e6a8c565131c9eae9dfc6e0a05
Showing with 6 additions and 1 deletion.
  1. +1 −0 src/app/qgssnappinglayertreemodel.h
  2. +4 −0 src/app/qgssnappingwidget.cpp
  3. +1 −1 src/core/qgsproject.cpp
@@ -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;

@@ -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 );
@@ -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" ) );
@@ -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 )

0 comments on commit 9a14e8d

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