27#include "moc_qgssymbolselectordialog.cpp"
29using namespace Qt::StringLiterals;
45#include <QColorDialog>
47#include <QStandardItemModel>
48#include <QInputDialog>
55#include <QStandardItem>
60static const int SYMBOL_LAYER_ITEM_TYPE = QStandardItem::UserType + 1;
70 mDDSize = mMarker->dataDefinedSize();
71 mDDAngle = mMarker->dataDefinedAngle();
73 if ( !mDDSize && !mDDAngle )
80 mDDWidth = mLine->dataDefinedWidth();
88void DataDefinedRestorer::save()
92 mSize = mMarkerSymbolLayer->size();
93 mAngle = mMarkerSymbolLayer->angle();
94 mMarkerOffset = mMarkerSymbolLayer->offset();
98 mWidth = mLineSymbolLayer->width();
99 mLineOffset = mLineSymbolLayer->offset();
103void DataDefinedRestorer::restore()
107 if ( mDDSize && ( mSize != mMarkerSymbolLayer->size() || mMarkerOffset != mMarkerSymbolLayer->offset() ) )
108 mMarker->setDataDefinedSize( mDDSize );
109 if ( mDDAngle && mAngle != mMarkerSymbolLayer->angle() )
110 mMarker->setDataDefinedAngle( mDDAngle );
114 if ( mDDWidth && ( mWidth != mLineSymbolLayer->width() || mLineOffset != mLineSymbolLayer->offset() ) )
115 mLine->setDataDefinedWidth( mDDWidth );
122class SymbolLayerItem :
public QStandardItem
125 explicit SymbolLayerItem( QgsSymbolLayer *layer,
Qgis::SymbolType symbolType, QgsVectorLayer *vectorLayer, QScreen *screen )
126 : mVectorLayer( vectorLayer )
129 setLayer( layer, symbolType );
132 explicit SymbolLayerItem( QgsSymbol *symbol, QgsVectorLayer *vectorLayer, QScreen *screen )
133 : mVectorLayer( vectorLayer )
144 mSymbolType = symbolType;
148 void setSymbol( QgsSymbol *symbol )
158 if ( !mSize.isValid() )
161 mSize = QSize( size, size );
168 QgsExpressionContext expContext;
174 if (
auto *lParent = parent() )
175 static_cast<SymbolLayerItem *
>( lParent )->updatePreview();
178 int type()
const override {
return SYMBOL_LAYER_ITEM_TYPE; }
179 bool isLayer()
const {
return mIsLayer; }
187 QgsSymbolLayer *layer()
192 QVariant data(
int role )
const override
194 if ( role == Qt::DisplayRole || role == Qt::EditRole )
206 switch ( mSymbol->type() )
209 return QCoreApplication::translate(
"SymbolLayerItem",
"Marker" );
211 return QCoreApplication::translate(
"SymbolLayerItem",
"Fill" );
213 return QCoreApplication::translate(
"SymbolLayerItem",
"Line" );
219 else if ( role == Qt::ForegroundRole && mIsLayer )
221 if ( !mLayer->enabled() )
223 QPalette pal = qApp->palette();
224 QBrush brush = QStandardItem::data( role ).value<QBrush>();
225 brush.setColor( pal.color( QPalette::Disabled, QPalette::WindowText ) );
236 if ( role == Qt::CheckStateRole )
238 return QStandardItem::data( role );
242 QgsSymbolLayer *mLayer =
nullptr;
243 QgsSymbol *mSymbol =
nullptr;
244 QPointer<QgsVectorLayer> mVectorLayer;
245 bool mIsLayer =
false;
248 QPointer<QScreen> mScreen;
262 setWindowModality( Qt::WindowModal );
266 this->layout()->setContentsMargins( 0, 0, 0, 0 );
268 layersTree->setMaximumHeight(
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 7 ) );
269 layersTree->setMinimumHeight( layersTree->maximumHeight() );
270 lblPreview->setMaximumWidth( layersTree->maximumHeight() );
284 iconColorLock.addFile(
QgsApplication::iconPath( u
"mIconColorUnlocked.svg"_s ), QSize(), QIcon::Normal, QIcon::Off );
285 iconColorLock.addFile(
QgsApplication::iconPath( u
"mIconColorUnlocked.svg"_s ), QSize(), QIcon::Active, QIcon::Off );
287 mLockColorAction =
new QAction( tr(
"Lock Color" ),
this );
288 mLockColorAction->setToolTip( tr(
"Avoid changing the color of the layer when the symbol color is changed" ) );
289 mLockColorAction->setCheckable(
true );
290 mLockColorAction->setIcon( iconColorLock );
292 QIcon iconSelectLock;
293 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectLocked.svg"_s ), QSize(), QIcon::Normal, QIcon::On );
294 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectLocked.svg"_s ), QSize(), QIcon::Active, QIcon::On );
295 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectUnlocked.svg"_s ), QSize(), QIcon::Normal, QIcon::Off );
296 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectUnlocked.svg"_s ), QSize(), QIcon::Active, QIcon::Off );
298 mLockSelectionColorAction =
new QAction( tr(
"Lock Color When Selected" ),
this );
299 mLockSelectionColorAction->setToolTip( tr(
"Avoid changing the color of the layer when a feature is selected" ) );
300 mLockSelectionColorAction->setCheckable(
true );
301 mLockSelectionColorAction->setIcon( iconSelectLock );
303 QMenu *lockMenu =
new QMenu(
this );
304 lockMenu->addAction( mLockColorAction );
305 lockMenu->addAction( mLockSelectionColorAction );
306 btnLock->setMenu( lockMenu );
307 btnLock->setPopupMode( QToolButton::InstantPopup );
313 mSymbolLayersModel =
new QStandardItemModel( layersTree );
315 layersTree->setModel( mSymbolLayersModel );
316 layersTree->setHeaderHidden(
true );
328 mPreviewExpressionContext.setFeature( mPreviewFeature );
336 QItemSelectionModel *selModel = layersTree->selectionModel();
339 loadSymbol( mSymbol,
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
347 connect( mLockSelectionColorAction, &QAction::toggled,
this, [
this](
bool checked ) {
355 updateLockButtonIcon();
361 updateLockButtonIcon();
366 const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
367 layersTree->setCurrentIndex( newIndex );
396 widget->mOwnedSymbol = std::move(
symbol );
402 if ( !mAdvancedMenu )
404 mAdvancedMenu =
new QMenu(
this );
408 return mAdvancedMenu;
415 if (
auto *lExpressionContext = mContext.expressionContext() )
417 mPreviewExpressionContext = *lExpressionContext;
421 mPreviewExpressionContext.setFeature( mPreviewFeature );
424 QWidget *widget = stackedWidget->currentWidget();
427 layerProp->setContext(
context );
431 listWidget->setContext(
context );
451 mSymbolLayersModel->clear();
452 parent =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() );
455 SymbolLayerItem *symbolItem =
new SymbolLayerItem(
symbol, mVectorLayer, screen() );
456 QFont boldFont = symbolItem->font();
457 boldFont.setBold(
true );
458 symbolItem->setFont( boldFont );
459 parent->appendRow( symbolItem );
461 const int count =
symbol->symbolLayerCount();
462 for (
int i = count - 1; i >= 0; i-- )
464 SymbolLayerItem *layerItem =
new SymbolLayerItem(
symbol->symbolLayer( i ),
symbol->type(), mVectorLayer, screen() );
465 layerItem->setEditable(
false );
466 symbolItem->appendRow( layerItem );
467 if (
symbol->symbolLayer( i )->subSymbol() )
471 layersTree->setExpanded( layerItem->index(),
true );
473 layersTree->setExpanded( symbolItem->index(),
true );
475 if ( mSymbol ==
symbol && !layersTree->currentIndex().isValid() )
478 layersTree->setCurrentIndex( symbolItem->index() );
482void QgsSymbolSelectorWidget::reloadSymbol()
484 mSymbolLayersModel->clear();
485 loadSymbol( mSymbol,
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
488void QgsSymbolSelectorWidget::updateUi()
490 const QModelIndex currentIdx = layersTree->currentIndex();
491 if ( !currentIdx.isValid() )
494 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( currentIdx ) );
495 if ( !item->isLayer() )
497 btnUp->setEnabled(
false );
498 btnDown->setEnabled(
false );
499 btnRemoveLayer->setEnabled(
false );
500 btnLock->setEnabled(
false );
501 btnDuplicate->setEnabled(
false );
505 const int rowCount = item->parent()->rowCount();
506 const int currentRow = item->row();
508 btnUp->setEnabled( currentRow > 0 );
509 btnDown->setEnabled( currentRow < rowCount - 1 );
510 btnRemoveLayer->setEnabled( rowCount > 1 );
511 btnLock->setEnabled(
true );
512 btnDuplicate->setEnabled(
true );
520 std::unique_ptr<QgsSymbol> symbolClone( mSymbol->clone() );
522 lblPreview->setPixmap( QPixmap::fromImage( preview ) );
524 if ( !mBlockModified )
531 SymbolLayerItem *item = currentLayerItem();
533 item->updatePreview();
538SymbolLayerItem *QgsSymbolSelectorWidget::currentLayerItem()
540 const QModelIndex idx = layersTree->currentIndex();
541 if ( !idx.isValid() )
544 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
545 if ( !item->isLayer() )
553 const QModelIndex idx = layersTree->currentIndex();
554 if ( !idx.isValid() )
557 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
558 if ( item->isLayer() )
559 return item->layer();
568 SymbolLayerItem *currentItem =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
572 if ( currentItem->isLayer() )
574 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( currentItem->parent() );
575 mDataDefineRestorer = std::make_unique<DataDefinedRestorer>( parent->symbol(), currentItem->layer() );
579 setWidget( layerProp );
590 mDataDefineRestorer.reset();
592 currentItem->symbol()->setLayer( mVectorLayer );
596 symbolsList->setContext( mContext );
598 setWidget( symbolsList );
606 SymbolLayerItem *currentItem =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
607 if ( !currentItem || currentItem->isLayer() )
611 if ( currentItem->parent() )
615 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( currentItem->parent() );
616 parent->removeRow( 0 );
618 layersTree->setCurrentIndex( parent->child( 0 )->index() );
619 parent->updatePreview();
625 const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
626 layersTree->setCurrentIndex( newIndex );
633void QgsSymbolSelectorWidget::setWidget( QWidget *widget )
635 const int index = stackedWidget->addWidget( widget );
636 stackedWidget->setCurrentIndex( index );
637 if ( mPresentWidget )
638 mPresentWidget->deleteLater();
639 mPresentWidget = widget;
642void QgsSymbolSelectorWidget::updateLockButton()
644 QgsSymbolLayer *layer = currentLayer();
647 mLockColorAction->setChecked( layer->
isLocked() );
650 updateLockButtonIcon();
653void QgsSymbolSelectorWidget::updateLockButtonIcon()
655 if ( mLockColorAction->isChecked() && mLockSelectionColorAction->isChecked() )
657 else if ( mLockColorAction->isChecked() )
659 else if ( mLockSelectionColorAction->isChecked() )
667 const QModelIndex idx = layersTree->currentIndex();
668 if ( !idx.isValid() )
672 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
673 if ( item->isLayer() )
675 insertIdx = item->row();
676 item =
static_cast<SymbolLayerItem *
>( item->parent() );
679 QgsSymbol *parentSymbol = item->symbol();
689 newLayerPtr = newLayer.get();
690 if ( insertIdx == -1 )
693 parentSymbol->
insertSymbolLayer( item->rowCount() - insertIdx, newLayer.release() );
698 static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedSize( ddSize );
700 static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedAngle( ddAngle );
702 static_cast<QgsLineSymbol *
>( parentSymbol )->setDataDefinedWidth( ddWidth );
706 SymbolLayerItem *newLayerItem =
new SymbolLayerItem( newLayerPtr, parentSymbol->
type(), mVectorLayer, screen() );
707 item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
708 item->updatePreview();
710 layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
717 SymbolLayerItem *item = currentLayerItem();
718 const int row = item->row();
719 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( item->parent() );
721 const int layerIdx = parent->rowCount() - row - 1;
722 QgsSymbol *parentSymbol = parent->symbol();
725 parent->removeRow( row );
726 parent->updatePreview();
728 const QModelIndex newIdx = parent->child( 0 )->index();
729 layersTree->setCurrentIndex( newIdx );
739 moveLayerByOffset( +1 );
744 moveLayerByOffset( -1 );
747void QgsSymbolSelectorWidget::moveLayerByOffset(
int offset )
749 SymbolLayerItem *item = currentLayerItem();
752 const int row = item->row();
754 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( item->parent() );
755 QgsSymbol *parentSymbol = parent->symbol();
757 const int layerIdx = parent->rowCount() - row - 1;
762 QList<QStandardItem *> rowItems = parent->takeRow( row );
763 parent->insertRows( row + offset, rowItems );
764 parent->updatePreview();
766 const QModelIndex newIdx = rowItems[0]->index();
767 layersTree->setCurrentIndex( newIdx );
778 layer->
setLocked( mLockColorAction->isChecked() );
779 updateLockButtonIcon();
785 const QModelIndex idx = layersTree->currentIndex();
786 if ( !idx.isValid() )
789 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
790 if ( !item->isLayer() )
795 const int insertIdx = item->row();
796 item =
static_cast<SymbolLayerItem *
>( item->parent() );
798 QgsSymbol *parentSymbol = item->symbol();
802 if ( insertIdx == -1 )
807 SymbolLayerItem *newLayerItem =
new SymbolLayerItem( newLayer, parentSymbol->
type(), mVectorLayer, screen() );
808 item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
812 layersTree->setExpanded( newLayerItem->index(),
true );
814 item->updatePreview();
816 layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
823 SymbolLayerItem *item = currentLayerItem();
825 if ( item->rowCount() > 0 )
827 item->removeRow( 0 );
829 QgsSymbol *
symbol =
static_cast<SymbolLayerItem *
>( item->parent() )->symbol();
832 item->setLayer( newLayer,
symbol->type() );
837 layersTree->setExpanded( item->index(),
true );
841 const int layerIdx = item->parent()->rowCount() - item->row() - 1;
842 symbol->changeSymbolLayer( layerIdx, newLayer );
844 item->updatePreview();
853 setLayout(
new QVBoxLayout() );
856 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
858 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
859 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
860 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsSymbolSelectorDialog::showHelp );
862 layout()->addWidget( mSelectorWidget );
863 layout()->addWidget( mButtonBox );
867 mSelectorWidget->setMinimumSize( 460, 560 );
868 setObjectName( u
"SymbolSelectorDialog"_s );
875 layout()->setContentsMargins( 0, 0, 0, 0 );
879 setWindowTitle( tr(
"Symbol Selector" ) );
881 mSelectorWidget->setDockMode( embedded );
886 return mSelectorWidget->advancedMenu();
891 mSelectorWidget->setContext(
context );
896 return mSelectorWidget->context();
901 return mSelectorWidget->symbol();
907 if ( !isWindow() && e->key() == Qt::Key_Escape )
913 QDialog::keyPressEvent( e );
917void QgsSymbolSelectorDialog::reloadSymbol()
919 mSelectorWidget->reloadSymbol();
924 mSelectorWidget->loadSymbol(
symbol, parent );
927void QgsSymbolSelectorDialog::updateUi()
929 mSelectorWidget->updateUi();
932void QgsSymbolSelectorDialog::updateLockButton()
934 mSelectorWidget->updateLockButton();
937SymbolLayerItem *QgsSymbolSelectorDialog::currentLayerItem()
939 return mSelectorWidget->currentLayerItem();
944 return mSelectorWidget->currentLayer();
947void QgsSymbolSelectorDialog::moveLayerByOffset(
int offset )
949 mSelectorWidget->moveLayerByOffset( offset );
952void QgsSymbolSelectorDialog::setWidget( QWidget *widget )
954 mSelectorWidget->setWidget( widget );
959 mSelectorWidget->moveLayerDown();
964 mSelectorWidget->moveLayerUp();
969 mSelectorWidget->addLayer();
974 mSelectorWidget->removeLayer();
979 mSelectorWidget->lockLayer();
984 mSelectorWidget->duplicateLayer();
989 mSelectorWidget->layerChanged();
994 mSelectorWidget->updateLayerPreview();
999 mSelectorWidget->updatePreview();
1004 mSelectorWidget->symbolChanged();
1009 mSelectorWidget->changeLayer( layer );
1017void QgsSymbolSelectorDialog::showHelp()
1022void QgsSymbolSelectorWidget::projectDataChanged()
1024 mBlockModified =
true;
1027 mBlockModified =
false;
1030void QgsSymbolSelectorWidget::layersAboutToBeRemoved(
const QList<QgsMapLayer *> &layers )
1032 if ( mVectorLayer && layers.contains( mVectorLayer ) )
QFlags< SymbolLayerUserFlag > SymbolLayerUserFlags
Symbol layer user flags.
@ Millimeters
Millimeters.
@ FlagIncludeCrosshairsForMarkerSymbols
Include a crosshairs reference image in the background of marker symbol previews.
@ DisableSelectionRecoloring
If present, indicates that the symbol layer should not be recolored when rendering selected features.
static const double UI_SCALE_FACTOR
UI scaling factor.
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
void appendScopes(const QList< QgsExpressionContextScope * > &scopes)
Appends a list of scopes to the end of the context.
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
Wraps a request for features to a vector layer (or directly its vector data provider).
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
void remoteImageFetched(const QString &url)
Emitted when the cache has finished retrieving an image file from a remote url.
Abstract base class for line symbol layers.
A line symbol type, for rendering LineString and MultiLineString geometries.
QgsProperty dataDefinedWidth() const
Returns data defined width for whole symbol (including all symbol layers).
Abstract base class for marker symbol layers.
A marker symbol type, for rendering Point and MultiPoint geometries.
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
static QgsProject * instance()
Returns the QgsProject singleton instance.
void layersWillBeRemoved(const QStringList &layerIds)
Emitted when one or more layers are about to be removed from the registry.
void projectColorsChanged()
Emitted whenever the project's color scheme has been changed.
A store for object properties.
Stores properties relating to a screen.
A database of saved style entities, including symbols, color ramps, text formats and others.
void remoteSvgFetched(const QString &url)
Emitted when the cache has finished retrieving an SVG file from a remote url.
static std::unique_ptr< QgsSymbolLayer > defaultSymbolLayer(Qgis::SymbolType type)
create a new instance of symbol layer for specified symbol type with default settings
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
Returns metadata for specified symbol layer. Returns nullptr if not found.
static QIcon symbolLayerPreviewIcon(const QgsSymbolLayer *layer, Qgis::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::SymbolType parentSymbolType=Qgis::SymbolType::Hybrid, QgsMapLayer *mapLayer=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Draws a symbol layer preview to an icon.
static QPixmap symbolPreviewPixmap(const QgsSymbol *symbol, QSize size, int padding=0, QgsRenderContext *customContext=nullptr, bool selected=false, const QgsExpressionContext *expressionContext=nullptr, const QgsLegendPatchShape *shape=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Returns a pixmap preview for a color ramp.
static void resetSymbolLayerIds(QgsSymbol *symbol)
Regenerate recursively unique id from all symbol symbol layers.
Abstract base class for symbol layers.
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
Qgis::SymbolType type() const
bool isLocked() const
Returns true if the symbol layer colors are locked and the layer will ignore any symbol-level color c...
void setUserFlags(Qgis::SymbolLayerUserFlags flags)
Sets user-controlled flags which control the symbol layer's behavior.
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
Qgis::SymbolLayerUserFlags userFlags() const
Returns user-controlled flags which control the symbol layer's behavior.
void setLocked(bool locked)
Sets whether the layer's colors are locked.
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
QgsSymbolSelectorDialog(QgsSymbol *symbol, QgsStyle *style, QgsVectorLayer *vl, QWidget *parent=nullptr, bool embedded=false)
Constructor for QgsSymbolSelectorDialog.
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
QMenu * advancedMenu()
Returns menu for "advanced" button - create it if doesn't exist and show the advanced button.
void symbolChanged()
Slot to update tree when a new symbol from style.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
QgsSymbol * symbol()
Returns the symbol that is currently active in the widget.
void keyPressEvent(QKeyEvent *e) override
void updateLayerPreview()
void duplicateLayer()
Duplicates the current symbol layer and places the duplicated layer above the current symbol layer.
void changeLayer(QgsSymbolLayer *layer)
Alters tree and sets proper widget when Layer Type is changed.
void loadSymbol(QgsSymbol *symbol, SymbolLayerItem *parent=nullptr)
Loads the given symbol into the widget.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
Abstract base class for all rendered symbols.
bool appendSymbolLayer(QgsSymbolLayer *layer)
Appends a symbol layer at the end of the current symbol layer list.
bool insertSymbolLayer(int index, QgsSymbolLayer *layer)
Inserts a symbol layer to specified index.
QgsSymbolLayer * takeSymbolLayer(int index)
Removes a symbol layer from the list and returns a pointer to it.
Qgis::SymbolType type() const
Returns the symbol's type.
Represents a vector layer which manages a vector based dataset.
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH