Skip to content

Commit

Permalink
Merge pull request #2542 from SebDieBln/RefreshStyleWidgetOnLoadStyle
Browse files Browse the repository at this point in the history
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 04caab2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgslabelingwidget.cpp
Expand Up @@ -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" )
{
Expand Down Expand Up @@ -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 ) )
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgslabelingwidget.h
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -474,6 +474,8 @@ void QgsVectorLayerProperties::syncToLayer( void )

actionDialog->init();

labelingDialog->adaptToLayer();

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

Expand Down

0 comments on commit 04caab2

Please sign in to comment.