QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas* canvas, QList<QgsMapLayerConfigWidgetFactory*> pages, QWidget *parent ) : QWidget( parent ) , mNotSupportedPage( 0 ) , mLayerPage( 1 ) , mMapCanvas( canvas ) , mBlockAutoApply( false ) , mCurrentLayer( nullptr ) , mLabelingWidget( nullptr ) , mRasterStyleWidget( nullptr ) , mPageFactories( pages ) { setupUi( this ); 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 ); mUndoWidget = new QgsUndoWidget( this, mMapCanvas ); mUndoWidget->setAutoDelete( false ); mUndoWidget->setObjectName( "Undo Styles" ); mUndoWidget->hide(); mStyleManagerFactory = new QgsLayerStyleManagerWidgetFactory(); QList<QgsMapLayerConfigWidgetFactory*> l; setPageFactories( pages ); connect( mUndoButton, SIGNAL( pressed() ), this, SLOT( undo() ) ); connect( mRedoButton, SIGNAL( pressed() ), this, SLOT( redo() ) ); connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) ); 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 ); }
QgsLayerStylingWidget::QgsLayerStylingWidget( QgsMapCanvas *canvas, const QList<QgsMapLayerConfigWidgetFactory *> &pages, QWidget *parent ) : QWidget( parent ) , mNotSupportedPage( 0 ) , mLayerPage( 1 ) , mMapCanvas( canvas ) , mBlockAutoApply( false ) , mCurrentLayer( nullptr ) , mLabelingWidget( nullptr ) , mRasterStyleWidget( nullptr ) , mPageFactories( pages ) { setupUi( this ); connect( QgsProject::instance(), static_cast < void ( QgsProject::* )( QgsMapLayer * ) > ( &QgsProject::layerWillBeRemoved ), this, &QgsLayerStylingWidget::layerAboutToBeRemoved ); QgsSettings settings; mLiveApplyCheck->setChecked( settings.value( QStringLiteral( "UI/autoApplyStyling" ), true ).toBool() ); mAutoApplyTimer = new QTimer( this ); mAutoApplyTimer->setSingleShot( true ); mUndoWidget = new QgsUndoWidget( this, mMapCanvas ); mUndoWidget->setAutoDelete( false ); mUndoWidget->setObjectName( QStringLiteral( "Undo Styles" ) ); mUndoWidget->hide(); mStyleManagerFactory = new QgsLayerStyleManagerWidgetFactory(); QList<QgsMapLayerConfigWidgetFactory *> l; setPageFactories( pages ); connect( mUndoButton, &QAbstractButton::pressed, this, &QgsLayerStylingWidget::undo ); connect( mRedoButton, &QAbstractButton::pressed, this, &QgsLayerStylingWidget::redo ); connect( mAutoApplyTimer, &QTimer::timeout, this, &QgsLayerStylingWidget::apply ); connect( mOptionsListWidget, &QListWidget::currentRowChanged, this, &QgsLayerStylingWidget::updateCurrentWidgetLayer ); connect( mButtonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsLayerStylingWidget::apply ); connect( mLayerCombo, &QgsMapLayerComboBox::layerChanged, this, &QgsLayerStylingWidget::setLayer ); connect( mLiveApplyCheck, &QAbstractButton::toggled, this, &QgsLayerStylingWidget::liveApplyToggled ); mStackedWidget->setCurrentIndex( 0 ); }