Skip to content

Commit

Permalink
Make styling widget live apply remember setting
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 10, 2016
1 parent a592167 commit fae6ee4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsmapstylingwidget.cpp
Expand Up @@ -57,6 +57,9 @@ QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QList<QgsMapStyl

connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QgsMapLayer* ) ), this, SLOT( layerAboutToBeRemoved( QgsMapLayer* ) ) );

QSettings settings;
mLiveApplyCheck->setChecked( settings.value( "UI/autoApplyStyling", true ).toBool() );

mAutoApplyTimer = new QTimer( this );
mAutoApplyTimer->setSingleShot( true );

Expand All @@ -74,6 +77,7 @@ QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QList<QgsMapStyl
connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( updateCurrentWidgetLayer() ) );
connect( mButtonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
connect( mLayerCombo, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SLOT( setLayer( QgsMapLayer* ) ) );
connect( mLiveApplyCheck, SIGNAL( toggled( bool ) ), this, SLOT( liveApplyToggled( bool ) ) );

mStackedWidget->setCurrentIndex( 0 );
}
Expand Down Expand Up @@ -366,6 +370,12 @@ void QgsMapStylingWidget::layerAboutToBeRemoved( QgsMapLayer* layer )
}
}

void QgsMapStylingWidget::liveApplyToggled( bool value )
{
QSettings settings;
settings.setValue( "UI/autoApplyStyling", value );
}

void QgsMapStylingWidget::pushUndoItem( const QString &name )
{
QString errorMsg;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmapstylingwidget.h
Expand Up @@ -85,6 +85,7 @@ class APP_EXPORT QgsMapStylingWidget : public QWidget, private Ui::QgsMapStyling
private slots:
void updateCurrentWidgetLayer();
void layerAboutToBeRemoved( QgsMapLayer* layer );
void liveApplyToggled( bool value );

private:
void pushUndoItem( const QString& name );
Expand Down

0 comments on commit fae6ee4

Please sign in to comment.