Skip to content
Permalink
Browse files

Refresh the label style widget when loading a new style (fixes #13667)

the QgsLabelingWidget is triggered to reload its settings when
- loading a style file
- loading a style from a database
- loading the default style
  • Loading branch information
SebDieBln committed Dec 6, 2015
1 parent 766bfa1 commit ab83b82593b70ff9634bf0135c2c6b375def00ac
Showing with 15 additions and 0 deletions.
  1. +10 −0 src/app/qgslabelingwidget.cpp
  2. +3 −0 src/app/qgslabelingwidget.h
  3. +2 −0 src/app/qgsvectorlayerproperties.cpp
@@ -20,6 +20,13 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canva

connect( mLabelModeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( labelModeChanged( int ) ) );

adaptToLayer();
}

void QgsLabelingWidget::adaptToLayer()
{
mLabelModeComboBox->setCurrentIndex( -1 );

// pick the right mode of the layer
if ( mLayer->labeling() && mLayer->labeling()->type() == "rule-based" )
{
@@ -68,6 +75,9 @@ void QgsLabelingWidget::apply()

void QgsLabelingWidget::labelModeChanged( int index )
{
if ( index < 0 )
return;

if ( index < 3 )
{
if ( QgsLabelingGui* widgetSimple = qobject_cast<QgsLabelingGui*>( mWidget ) )
@@ -26,6 +26,9 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget
//! Saves the labeling configuration and immediately updates the map canvas to reflect the changes
void apply();

//! reload the settings shown in the dialog from the current layer
void adaptToLayer();

protected slots:
void labelModeChanged( int index );
void showEngineConfigDialog();
@@ -466,6 +466,8 @@ void QgsVectorLayerProperties::syncToLayer( void )

actionDialog->init();

labelingDialog->adaptToLayer();

// reset fields in label dialog
layer->label()->setFields( layer->fields() );

0 comments on commit ab83b82

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