Skip to content
Permalink
Browse files

Merge pull request #3054 from dgoedkoop/loadstylelabels214

[Bugfix] Update labeling settings after loading style from file (fixes #14224)
  • Loading branch information
m-kuhn committed May 21, 2016
2 parents cf2ebb8 + 272b16a commit c260a77ec2073e0468803a47e6af0d49a1bd0f53
Showing with 17 additions and 5 deletions.
  1. +14 −5 src/app/qgslabelingwidget.cpp
  2. +3 −0 src/app/qgslabelingwidget.h
@@ -41,6 +41,10 @@ void QgsLabelingWidget::adaptToLayer()
{
mLabelModeComboBox->setCurrentIndex( -1 );

// Delete the widget, so that labelModeChanged() recreates it with
// settings loaded from the layer
deleteWidget();

// pick the right mode of the layer
if ( mLayer->labeling() && mLayer->labeling()->type() == "rule-based" )
{
@@ -107,11 +111,7 @@ void QgsLabelingWidget::labelModeChanged( int index )

// in general case we need to recreate the widget

if ( mWidget )
mStackedWidget->removeWidget( mWidget );

delete mWidget;
mWidget = nullptr;
deleteWidget();

if ( index == 2 )
{
@@ -139,3 +139,12 @@ void QgsLabelingWidget::showEngineConfigDialog()
QgsLabelEngineConfigDialog dlg( this );
dlg.exec();
}

void QgsLabelingWidget::deleteWidget()
{
if ( mWidget )
mStackedWidget->removeWidget( mWidget );

delete mWidget;
mWidget = nullptr;
}
@@ -38,6 +38,9 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget
QgsMapCanvas* mCanvas;

QWidget* mWidget;

//! Delete the child widget
void deleteWidget();
};

#endif // QGSLABELINGWIDGET_H

0 comments on commit c260a77

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