Skip to content
Permalink
Browse files

Merge pull request #2542 from SebDieBln/RefreshStyleWidgetOnLoadStyle

Refresh the label style widget when loading a new style (fixes #13667)
  • Loading branch information
nyalldawson committed Jan 13, 2016
2 parents 21cdefa + ab83b82 commit 04caab24a722ae13006f41baef7e12d191e32d3b
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
@@ -34,6 +34,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" )
{
@@ -82,6 +89,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();
@@ -474,6 +474,8 @@ void QgsVectorLayerProperties::syncToLayer( void )

actionDialog->init();

labelingDialog->adaptToLayer();

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

0 comments on commit 04caab2

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