Skip to content

Commit 5f2d98c

Browse files
committedOct 10, 2015
Merge pull request #2361 from m-kuhn/fix13549
Cleanup symbol definition widgets when switching between symbol layers
2 parents 80ccb39 + b82c146 commit 5f2d98c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed
 

‎src/gui/symbology-ng/qgssymbolslistwidget.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ QgsSymbolsListWidget::QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* sty
118118
btnColor->setContext( "symbology" );
119119
}
120120

121+
QgsSymbolsListWidget::~QgsSymbolsListWidget()
122+
{
123+
// This action was added to the menu by this widget, clean it up
124+
// The menu can be passed in the constructor, so may live longer than this widget
125+
btnAdvanced->menu()->removeAction( mClipFeaturesAction );
126+
}
127+
121128
void QgsSymbolsListWidget::setMapCanvas( QgsMapCanvas* canvas )
122129
{
123130
mMapCanvas = canvas;

‎src/gui/symbology-ng/qgssymbolslistwidget.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ class GUI_EXPORT QgsSymbolsListWidget : public QWidget, private Ui::SymbolsListW
3232
public:
3333
QgsSymbolsListWidget( QgsSymbolV2* symbol, QgsStyleV2* style, QMenu* menu, QWidget* parent, const QgsVectorLayer * layer = 0 );
3434

35+
//! Destructor
36+
virtual ~QgsSymbolsListWidget();
37+
3538
/** Returns the expression context used for the widget, if set. This expression context is used for
3639
* evaluating data defined symbol properties and for populating based expression widgets in
3740
* the list widget.
3841
* @note added in QGIS 2.12
3942
* @see setExpressionContext()
4043
*/
44+
4145
QgsExpressionContext* expressionContext() const { return mPresetExpressionContext; }
4246

4347
/** Sets the map canvas associated with the widget. This allows the widget to retrieve the current

‎src/gui/symbology-ng/qgssymbolv2selectordialog.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,13 +472,8 @@ void QgsSymbolV2SelectorDialog::setWidget( QWidget* widget )
472472
{
473473
int index = stackedWidget->addWidget( widget );
474474
stackedWidget->setCurrentIndex( index );
475-
if ( mPresentWidget )
476-
{
477-
stackedWidget->removeWidget( mPresentWidget );
478-
QWidget *dummy = mPresentWidget;
479-
mPresentWidget = widget;
480-
delete dummy; // auto disconnects all signals
481-
}
475+
delete mPresentWidget;
476+
mPresentWidget = widget;
482477
}
483478

484479
void QgsSymbolV2SelectorDialog::updateLockButton()

0 commit comments

Comments
 (0)
Please sign in to comment.