Skip to content

Commit

Permalink
restore original subset string on dialog cancel (fix #13620)
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln authored and m-kuhn committed Nov 18, 2015
1 parent f7bdd66 commit 5399855
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
: QgsOptionsDialogBase( "VectorLayerProperties", parent, fl )
, layer( lyr )
, mMetadataFilled( false )
, mOriginalSubsetSQL( lyr->subsetString() )
, mSaveAsMenu( 0 )
, mLoadStyleMenu( 0 )
, mRendererDialog( 0 )
Expand Down Expand Up @@ -531,6 +532,7 @@ void QgsVectorLayerProperties::apply()
layer->setSubsetString( txtSubsetSQL->toPlainText() );
mMetadataFilled = false;
}
mOriginalSubsetSQL = layer->subsetString();

// set up the scale based layer visibility stuff....
layer->setScaleBasedVisibility( mScaleVisibilityGroupBox->isChecked() );
Expand Down Expand Up @@ -644,6 +646,14 @@ void QgsVectorLayerProperties::onCancel()
Q_FOREACH ( const QgsVectorJoinInfo& info, mOldJoins )
layer->addJoin( info );
}

if ( mOriginalSubsetSQL != layer->subsetString() )
{
// need to undo changes in subset string - they are applied directly to the layer (not in apply())
// by QgsQueryBuilder::accept()

layer->setSubsetString( mOriginalSubsetSQL );
}
}

void QgsVectorLayerProperties::on_pbnQueryBuilder_clicked()
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsvectorlayerproperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private

bool mMetadataFilled;

QString mOriginalSubsetSQL;

QMenu *mSaveAsMenu;
QMenu *mLoadStyleMenu;

Expand Down

0 comments on commit 5399855

Please sign in to comment.