Skip to content

Commit ab83b82

Browse files
committedDec 30, 2015
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
1 parent 766bfa1 commit ab83b82

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed
 

‎src/app/qgslabelingwidget.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canva
2020

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

23+
adaptToLayer();
24+
}
25+
26+
void QgsLabelingWidget::adaptToLayer()
27+
{
28+
mLabelModeComboBox->setCurrentIndex( -1 );
29+
2330
// pick the right mode of the layer
2431
if ( mLayer->labeling() && mLayer->labeling()->type() == "rule-based" )
2532
{
@@ -68,6 +75,9 @@ void QgsLabelingWidget::apply()
6875

6976
void QgsLabelingWidget::labelModeChanged( int index )
7077
{
78+
if ( index < 0 )
79+
return;
80+
7181
if ( index < 3 )
7282
{
7383
if ( QgsLabelingGui* widgetSimple = qobject_cast<QgsLabelingGui*>( mWidget ) )

‎src/app/qgslabelingwidget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ class QgsLabelingWidget : public QWidget, private Ui::QgsLabelingWidget
2626
//! Saves the labeling configuration and immediately updates the map canvas to reflect the changes
2727
void apply();
2828

29+
//! reload the settings shown in the dialog from the current layer
30+
void adaptToLayer();
31+
2932
protected slots:
3033
void labelModeChanged( int index );
3134
void showEngineConfigDialog();

‎src/app/qgsvectorlayerproperties.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,8 @@ void QgsVectorLayerProperties::syncToLayer( void )
466466

467467
actionDialog->init();
468468

469+
labelingDialog->adaptToLayer();
470+
469471
// reset fields in label dialog
470472
layer->label()->setFields( layer->fields() );
471473

0 commit comments

Comments
 (0)
Please sign in to comment.