Skip to content

Commit 5399855

Browse files
SebDieBlnm-kuhn
authored andcommitted
restore original subset string on dialog cancel (fix #13620)
1 parent f7bdd66 commit 5399855

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/app/qgsvectorlayerproperties.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
7676
: QgsOptionsDialogBase( "VectorLayerProperties", parent, fl )
7777
, layer( lyr )
7878
, mMetadataFilled( false )
79+
, mOriginalSubsetSQL( lyr->subsetString() )
7980
, mSaveAsMenu( 0 )
8081
, mLoadStyleMenu( 0 )
8182
, mRendererDialog( 0 )
@@ -531,6 +532,7 @@ void QgsVectorLayerProperties::apply()
531532
layer->setSubsetString( txtSubsetSQL->toPlainText() );
532533
mMetadataFilled = false;
533534
}
535+
mOriginalSubsetSQL = layer->subsetString();
534536

535537
// set up the scale based layer visibility stuff....
536538
layer->setScaleBasedVisibility( mScaleVisibilityGroupBox->isChecked() );
@@ -644,6 +646,14 @@ void QgsVectorLayerProperties::onCancel()
644646
Q_FOREACH ( const QgsVectorJoinInfo& info, mOldJoins )
645647
layer->addJoin( info );
646648
}
649+
650+
if ( mOriginalSubsetSQL != layer->subsetString() )
651+
{
652+
// need to undo changes in subset string - they are applied directly to the layer (not in apply())
653+
// by QgsQueryBuilder::accept()
654+
655+
layer->setSubsetString( mOriginalSubsetSQL );
656+
}
647657
}
648658

649659
void QgsVectorLayerProperties::on_pbnQueryBuilder_clicked()

src/app/qgsvectorlayerproperties.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
163163

164164
bool mMetadataFilled;
165165

166+
QString mOriginalSubsetSQL;
167+
166168
QMenu *mSaveAsMenu;
167169
QMenu *mLoadStyleMenu;
168170

0 commit comments

Comments
 (0)