@@ -84,6 +84,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
84
84
85
85
connect ( buttonBox->button ( QDialogButtonBox::Apply ), SIGNAL ( clicked () ), this , SLOT ( apply () ) );
86
86
connect ( this , SIGNAL ( accepted () ), this , SLOT ( apply () ) );
87
+ connect ( this , SIGNAL ( rejected () ), this , SLOT ( onCancel () ) );
87
88
88
89
connect ( mOptionsStackedWidget , SIGNAL ( currentChanged ( int ) ), this , SLOT ( mOptionsStackedWidget_CurrentChanged ( int ) ) );
89
90
@@ -214,6 +215,8 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
214
215
addJoinToTreeWidget ( joins[i] );
215
216
}
216
217
218
+ mOldJoins = layer->vectorJoins ();
219
+
217
220
diagramPropertiesDialog = new QgsDiagramProperties ( layer, mDiagramFrame );
218
221
diagramPropertiesDialog->layout ()->setMargin ( 0 );
219
222
mDiagramFrame ->setLayout ( new QVBoxLayout ( mDiagramFrame ) );
@@ -571,6 +574,8 @@ void QgsVectorLayerProperties::apply()
571
574
simplifyMethod.setMaximumScale ( 1.0 / mSimplifyMaximumScaleComboBox ->scale () );
572
575
layer->setSimplifyMethod ( simplifyMethod );
573
576
577
+ mOldJoins = layer->vectorJoins ();
578
+
574
579
// update symbology
575
580
emit refreshLegend ( layer->id () );
576
581
@@ -579,6 +584,21 @@ void QgsVectorLayerProperties::apply()
579
584
QgsProject::instance ()->dirty ( true );
580
585
}
581
586
587
+ void QgsVectorLayerProperties::onCancel ()
588
+ {
589
+ if ( mOldJoins != layer->vectorJoins () )
590
+ {
591
+ // need to undo changes in vector layer joins - they are applied directly to the layer (not in apply())
592
+ // so other parts of the properties dialog can use the fields from the joined layers
593
+
594
+ foreach ( const QgsVectorJoinInfo& info, layer->vectorJoins () )
595
+ layer->removeJoin ( info.joinLayerId );
596
+
597
+ foreach ( const QgsVectorJoinInfo& info, mOldJoins )
598
+ layer->addJoin ( info );
599
+ }
600
+ }
601
+
582
602
void QgsVectorLayerProperties::on_pbnQueryBuilder_clicked ()
583
603
{
584
604
// launch the query builder
0 commit comments