Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 30, 2015
1 parent 766bfa1 commit ab83b82
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 @@ -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" )
{
Expand Down Expand Up @@ -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 ) )
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 @@ -466,6 +466,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 ab83b82

Please sign in to comment.