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 );
169 QgsExpressionContext expContext;
175 if (
auto *lParent = parent() )
176 static_cast<SymbolLayerItem *
>( lParent )->updatePreview();
179 int type()
const override {
return SYMBOL_LAYER_ITEM_TYPE; }
180 bool isLayer()
const {
return mIsLayer; }
183 QgsSymbol *symbol() {
return mSymbol; }
185 QgsSymbolLayer *layer() {
return mLayer; }
187 QVariant data(
int role )
const override
189 if ( role == Qt::DisplayRole || role == Qt::EditRole )
201 switch ( mSymbol->type() )
204 return QCoreApplication::translate(
"SymbolLayerItem",
"Marker" );
206 return QCoreApplication::translate(
"SymbolLayerItem",
"Fill" );
208 return QCoreApplication::translate(
"SymbolLayerItem",
"Line" );
214 else if ( role == Qt::ForegroundRole && mIsLayer )
216 if ( !mLayer->enabled() )
218 QPalette pal = qApp->palette();
219 QBrush brush = QStandardItem::data( role ).value<QBrush>();
220 brush.setColor( pal.color( QPalette::Disabled, QPalette::WindowText ) );
231 if ( role == Qt::CheckStateRole )
233 return QStandardItem::data( role );
237 QgsSymbolLayer *mLayer =
nullptr;
238 QgsSymbol *mSymbol =
nullptr;
239 QPointer<QgsVectorLayer> mVectorLayer;
240 bool mIsLayer =
false;
243 QPointer<QScreen> mScreen;
257 setWindowModality( Qt::WindowModal );
261 this->layout()->setContentsMargins( 0, 0, 0, 0 );
263 layersTree->setMaximumHeight(
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 7 ) );
264 layersTree->setMinimumHeight( layersTree->maximumHeight() );
265 lblPreview->setMaximumWidth( layersTree->maximumHeight() );
279 iconColorLock.addFile(
QgsApplication::iconPath( u
"mIconColorUnlocked.svg"_s ), QSize(), QIcon::Normal, QIcon::Off );
280 iconColorLock.addFile(
QgsApplication::iconPath( u
"mIconColorUnlocked.svg"_s ), QSize(), QIcon::Active, QIcon::Off );
282 mLockColorAction =
new QAction( tr(
"Lock Color" ),
this );
283 mLockColorAction->setToolTip( tr(
"Avoid changing the color of the layer when the symbol color is changed" ) );
284 mLockColorAction->setCheckable(
true );
285 mLockColorAction->setIcon( iconColorLock );
287 QIcon iconSelectLock;
288 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectLocked.svg"_s ), QSize(), QIcon::Normal, QIcon::On );
289 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectLocked.svg"_s ), QSize(), QIcon::Active, QIcon::On );
290 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectUnlocked.svg"_s ), QSize(), QIcon::Normal, QIcon::Off );
291 iconSelectLock.addFile(
QgsApplication::iconPath( u
"mIconSelectUnlocked.svg"_s ), QSize(), QIcon::Active, QIcon::Off );
293 mLockSelectionColorAction =
new QAction( tr(
"Lock Color When Selected" ),
this );
294 mLockSelectionColorAction->setToolTip( tr(
"Avoid changing the color of the layer when a feature is selected" ) );
295 mLockSelectionColorAction->setCheckable(
true );
296 mLockSelectionColorAction->setIcon( iconSelectLock );
298 QMenu *lockMenu =
new QMenu(
this );
299 lockMenu->addAction( mLockColorAction );
300 lockMenu->addAction( mLockSelectionColorAction );
301 btnLock->setMenu( lockMenu );
302 btnLock->setPopupMode( QToolButton::InstantPopup );
308 mSymbolLayersModel =
new QStandardItemModel( layersTree );
310 layersTree->setModel( mSymbolLayersModel );
311 layersTree->setHeaderHidden(
true );
323 mPreviewExpressionContext.setFeature( mPreviewFeature );
331 QItemSelectionModel *selModel = layersTree->selectionModel();
334 loadSymbol( mSymbol,
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
342 connect( mLockSelectionColorAction, &QAction::toggled,
this, [
this](
bool checked ) {
350 updateLockButtonIcon();
356 updateLockButtonIcon();
361 const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
362 layersTree->setCurrentIndex( newIndex );
391 widget->mOwnedSymbol = std::move(
symbol );
397 if ( !mAdvancedMenu )
399 mAdvancedMenu =
new QMenu(
this );
403 return mAdvancedMenu;
410 if (
auto *lExpressionContext = mContext.expressionContext() )
412 mPreviewExpressionContext = *lExpressionContext;
416 mPreviewExpressionContext.setFeature( mPreviewFeature );
419 QWidget *widget = stackedWidget->currentWidget();
422 layerProp->setContext(
context );
426 listWidget->setContext(
context );
446 mSymbolLayersModel->clear();
447 parent =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() );
450 SymbolLayerItem *symbolItem =
new SymbolLayerItem(
symbol, mVectorLayer, screen() );
451 QFont boldFont = symbolItem->font();
452 boldFont.setBold(
true );
453 symbolItem->setFont( boldFont );
454 parent->appendRow( symbolItem );
456 const int count =
symbol->symbolLayerCount();
457 for (
int i = count - 1; i >= 0; i-- )
459 SymbolLayerItem *layerItem =
new SymbolLayerItem(
symbol->symbolLayer( i ),
symbol->type(), mVectorLayer, screen() );
460 layerItem->setEditable(
false );
461 symbolItem->appendRow( layerItem );
462 if (
symbol->symbolLayer( i )->subSymbol() )
466 layersTree->setExpanded( layerItem->index(),
true );
468 layersTree->setExpanded( symbolItem->index(),
true );
470 if ( mSymbol ==
symbol && !layersTree->currentIndex().isValid() )
473 layersTree->setCurrentIndex( symbolItem->index() );
477void QgsSymbolSelectorWidget::reloadSymbol()
479 mSymbolLayersModel->clear();
480 loadSymbol( mSymbol,
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
483void QgsSymbolSelectorWidget::updateUi()
485 const QModelIndex currentIdx = layersTree->currentIndex();
486 if ( !currentIdx.isValid() )
489 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( currentIdx ) );
490 if ( !item->isLayer() )
492 btnUp->setEnabled(
false );
493 btnDown->setEnabled(
false );
494 btnRemoveLayer->setEnabled(
false );
495 btnLock->setEnabled(
false );
496 btnDuplicate->setEnabled(
false );
500 const int rowCount = item->parent()->rowCount();
501 const int currentRow = item->row();
503 btnUp->setEnabled( currentRow > 0 );
504 btnDown->setEnabled( currentRow < rowCount - 1 );
505 btnRemoveLayer->setEnabled( rowCount > 1 );
506 btnLock->setEnabled(
true );
507 btnDuplicate->setEnabled(
true );
515 std::unique_ptr<QgsSymbol> symbolClone( mSymbol->clone() );
517 lblPreview->setPixmap( QPixmap::fromImage( preview ) );
519 if ( !mBlockModified )
526 SymbolLayerItem *item = currentLayerItem();
528 item->updatePreview();
533SymbolLayerItem *QgsSymbolSelectorWidget::currentLayerItem()
535 const QModelIndex idx = layersTree->currentIndex();
536 if ( !idx.isValid() )
539 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
540 if ( !item->isLayer() )
548 const QModelIndex idx = layersTree->currentIndex();
549 if ( !idx.isValid() )
552 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
553 if ( item->isLayer() )
554 return item->layer();
563 SymbolLayerItem *currentItem =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
567 if ( currentItem->isLayer() )
569 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( currentItem->parent() );
570 mDataDefineRestorer = std::make_unique<DataDefinedRestorer>( parent->symbol(), currentItem->layer() );
574 setWidget( layerProp );
585 mDataDefineRestorer.reset();
587 currentItem->symbol()->setLayer( mVectorLayer );
591 symbolsList->setContext( mContext );
593 setWidget( symbolsList );
601 SymbolLayerItem *currentItem =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
602 if ( !currentItem || currentItem->isLayer() )
606 if ( currentItem->parent() )
610 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( currentItem->parent() );
611 parent->removeRow( 0 );
613 layersTree->setCurrentIndex( parent->child( 0 )->index() );
614 parent->updatePreview();
620 const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
621 layersTree->setCurrentIndex( newIndex );
628void QgsSymbolSelectorWidget::setWidget( QWidget *widget )
630 const int index = stackedWidget->addWidget( widget );
631 stackedWidget->setCurrentIndex( index );
632 if ( mPresentWidget )
633 mPresentWidget->deleteLater();
634 mPresentWidget = widget;
637void QgsSymbolSelectorWidget::updateLockButton()
639 QgsSymbolLayer *layer = currentLayer();
642 mLockColorAction->setChecked( layer->
isLocked() );
645 updateLockButtonIcon();
648void QgsSymbolSelectorWidget::updateLockButtonIcon()
650 if ( mLockColorAction->isChecked() && mLockSelectionColorAction->isChecked() )
652 else if ( mLockColorAction->isChecked() )
654 else if ( mLockSelectionColorAction->isChecked() )
662 const QModelIndex idx = layersTree->currentIndex();
663 if ( !idx.isValid() )
667 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
668 if ( item->isLayer() )
670 insertIdx = item->row();
671 item =
static_cast<SymbolLayerItem *
>( item->parent() );
674 QgsSymbol *parentSymbol = item->symbol();
684 newLayerPtr = newLayer.get();
685 if ( insertIdx == -1 )
688 parentSymbol->
insertSymbolLayer( item->rowCount() - insertIdx, newLayer.release() );
693 static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedSize( ddSize );
695 static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedAngle( ddAngle );
697 static_cast<QgsLineSymbol *
>( parentSymbol )->setDataDefinedWidth( ddWidth );
701 SymbolLayerItem *newLayerItem =
new SymbolLayerItem( newLayerPtr, parentSymbol->
type(), mVectorLayer, screen() );
702 item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
703 item->updatePreview();
705 layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
712 SymbolLayerItem *item = currentLayerItem();
713 const int row = item->row();
714 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( item->parent() );
716 const int layerIdx = parent->rowCount() - row - 1;
717 QgsSymbol *parentSymbol = parent->symbol();
720 parent->removeRow( row );
721 parent->updatePreview();
723 const QModelIndex newIdx = parent->child( 0 )->index();
724 layersTree->setCurrentIndex( newIdx );
734 moveLayerByOffset( +1 );
739 moveLayerByOffset( -1 );
742void QgsSymbolSelectorWidget::moveLayerByOffset(
int offset )
744 SymbolLayerItem *item = currentLayerItem();
747 const int row = item->row();
749 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( item->parent() );
750 QgsSymbol *parentSymbol = parent->symbol();
752 const int layerIdx = parent->rowCount() - row - 1;
757 QList<QStandardItem *> rowItems = parent->takeRow( row );
758 parent->insertRows( row + offset, rowItems );
759 parent->updatePreview();
761 const QModelIndex newIdx = rowItems[0]->index();
762 layersTree->setCurrentIndex( newIdx );
773 layer->
setLocked( mLockColorAction->isChecked() );
774 updateLockButtonIcon();
780 const QModelIndex idx = layersTree->currentIndex();
781 if ( !idx.isValid() )
784 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
785 if ( !item->isLayer() )
790 const int insertIdx = item->row();
791 item =
static_cast<SymbolLayerItem *
>( item->parent() );
793 QgsSymbol *parentSymbol = item->symbol();
797 if ( insertIdx == -1 )
802 SymbolLayerItem *newLayerItem =
new SymbolLayerItem( newLayer, parentSymbol->
type(), mVectorLayer, screen() );
803 item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
807 layersTree->setExpanded( newLayerItem->index(),
true );
809 item->updatePreview();
811 layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
818 SymbolLayerItem *item = currentLayerItem();
820 if ( item->rowCount() > 0 )
822 item->removeRow( 0 );
824 QgsSymbol *
symbol =
static_cast<SymbolLayerItem *
>( item->parent() )->symbol();
827 item->setLayer( newLayer,
symbol->type() );
832 layersTree->setExpanded( item->index(),
true );
836 const int layerIdx = item->parent()->rowCount() - item->row() - 1;
837 symbol->changeSymbolLayer( layerIdx, newLayer );
839 item->updatePreview();
848 setLayout(
new QVBoxLayout() );
851 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
853 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
854 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
855 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsSymbolSelectorDialog::showHelp );
857 layout()->addWidget( mSelectorWidget );
858 layout()->addWidget( mButtonBox );
862 mSelectorWidget->setMinimumSize( 460, 560 );
863 setObjectName( u
"SymbolSelectorDialog"_s );
870 layout()->setContentsMargins( 0, 0, 0, 0 );
874 setWindowTitle( tr(
"Symbol Selector" ) );
876 mSelectorWidget->setDockMode( embedded );
881 return mSelectorWidget->advancedMenu();
886 mSelectorWidget->setContext(
context );
891 return mSelectorWidget->context();
896 return mSelectorWidget->symbol();
902 if ( !isWindow() && e->key() == Qt::Key_Escape )
908 QDialog::keyPressEvent( e );
912void QgsSymbolSelectorDialog::reloadSymbol()
914 mSelectorWidget->reloadSymbol();
919 mSelectorWidget->loadSymbol(
symbol, parent );
922void QgsSymbolSelectorDialog::updateUi()
924 mSelectorWidget->updateUi();
927void QgsSymbolSelectorDialog::updateLockButton()
929 mSelectorWidget->updateLockButton();
932SymbolLayerItem *QgsSymbolSelectorDialog::currentLayerItem()
934 return mSelectorWidget->currentLayerItem();
939 return mSelectorWidget->currentLayer();
942void QgsSymbolSelectorDialog::moveLayerByOffset(
int offset )
944 mSelectorWidget->moveLayerByOffset( offset );
947void QgsSymbolSelectorDialog::setWidget( QWidget *widget )
949 mSelectorWidget->setWidget( widget );
954 mSelectorWidget->moveLayerDown();
959 mSelectorWidget->moveLayerUp();
964 mSelectorWidget->addLayer();
969 mSelectorWidget->removeLayer();
974 mSelectorWidget->lockLayer();
979 mSelectorWidget->duplicateLayer();
984 mSelectorWidget->layerChanged();
989 mSelectorWidget->updateLayerPreview();
994 mSelectorWidget->updatePreview();
999 mSelectorWidget->symbolChanged();
1004 mSelectorWidget->changeLayer( layer );
1012void QgsSymbolSelectorDialog::showHelp()
1017void QgsSymbolSelectorWidget::projectDataChanged()
1019 mBlockModified =
true;
1022 mBlockModified =
false;
1025void QgsSymbolSelectorWidget::layersAboutToBeRemoved(
const QList<QgsMapLayer *> &layers )
1027 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