Skip to content
Permalink
Browse files

Update labeling settings in UI after loading style from file (fixes #…

  • Loading branch information
dgoedkoop committed May 2, 2016
1 parent dd136f6 commit 272b16a7522280b020f6bb8c014975c7cf09d603
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 272b16a

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