25#include "moc_qgssymbolselectordialog.cpp"
41#include <QColorDialog>
43#include <QStandardItemModel>
44#include <QInputDialog>
51#include <QStandardItem>
56static const int SYMBOL_LAYER_ITEM_TYPE = QStandardItem::UserType + 1;
66 mDDSize = mMarker->dataDefinedSize();
67 mDDAngle = mMarker->dataDefinedAngle();
69 if ( !mDDSize && !mDDAngle )
76 mDDWidth = mLine->dataDefinedWidth();
84void DataDefinedRestorer::save()
88 mSize = mMarkerSymbolLayer->size();
89 mAngle = mMarkerSymbolLayer->angle();
90 mMarkerOffset = mMarkerSymbolLayer->offset();
94 mWidth = mLineSymbolLayer->width();
95 mLineOffset = mLineSymbolLayer->offset();
99void DataDefinedRestorer::restore()
103 if ( mDDSize && ( mSize != mMarkerSymbolLayer->size() || mMarkerOffset != mMarkerSymbolLayer->offset() ) )
104 mMarker->setDataDefinedSize( mDDSize );
105 if ( mDDAngle && mAngle != mMarkerSymbolLayer->angle() )
106 mMarker->setDataDefinedAngle( mDDAngle );
110 if ( mDDWidth && ( mWidth != mLineSymbolLayer->width() || mLineOffset != mLineSymbolLayer->offset() ) )
111 mLine->setDataDefinedWidth( mDDWidth );
118class SymbolLayerItem :
public QStandardItem
121 explicit SymbolLayerItem( QgsSymbolLayer *layer,
Qgis::SymbolType symbolType, QgsVectorLayer *vectorLayer, QScreen *screen )
122 : mVectorLayer( vectorLayer )
125 setLayer( layer, symbolType );
128 explicit SymbolLayerItem( QgsSymbol *symbol, QgsVectorLayer *vectorLayer, QScreen *screen )
129 : mVectorLayer( vectorLayer )
140 mSymbolType = symbolType;
144 void setSymbol( QgsSymbol *symbol )
154 if ( !mSize.isValid() )
157 mSize = QSize( size, size );
164 QgsExpressionContext expContext;
170 if (
auto *lParent = parent() )
171 static_cast<SymbolLayerItem *
>( lParent )->updatePreview();
174 int type()
const override {
return SYMBOL_LAYER_ITEM_TYPE; }
175 bool isLayer()
const {
return mIsLayer; }
183 QgsSymbolLayer *layer()
188 QVariant data(
int role )
const override
190 if ( role == Qt::DisplayRole || role == Qt::EditRole )
202 switch ( mSymbol->type() )
205 return QCoreApplication::translate(
"SymbolLayerItem",
"Marker" );
207 return QCoreApplication::translate(
"SymbolLayerItem",
"Fill" );
209 return QCoreApplication::translate(
"SymbolLayerItem",
"Line" );
215 else if ( role == Qt::ForegroundRole && mIsLayer )
217 if ( !mLayer->enabled() )
219 QPalette pal = qApp->palette();
220 QBrush brush = QStandardItem::data( role ).value<QBrush>();
221 brush.setColor( pal.color( QPalette::Disabled, QPalette::WindowText ) );
232 if ( role == Qt::CheckStateRole )
234 return QStandardItem::data( role );
238 QgsSymbolLayer *mLayer =
nullptr;
239 QgsSymbol *mSymbol =
nullptr;
240 QPointer<QgsVectorLayer> mVectorLayer;
241 bool mIsLayer =
false;
244 QPointer<QScreen> mScreen;
258 setWindowModality( Qt::WindowModal );
262 this->layout()->setContentsMargins( 0, 0, 0, 0 );
264 layersTree->setMaximumHeight(
static_cast<int>(
Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 7 ) );
265 layersTree->setMinimumHeight( layersTree->maximumHeight() );
266 lblPreview->setMaximumWidth( layersTree->maximumHeight() );
274 iconLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"unlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
275 iconLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"unlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
278 iconColorLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconColorLocked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
279 iconColorLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconColorLocked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
280 iconColorLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconColorUnlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
281 iconColorLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconColorUnlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
283 mLockColorAction =
new QAction( tr(
"Lock Color" ),
this );
284 mLockColorAction->setToolTip( tr(
"Avoid changing the color of the layer when the symbol color is changed" ) );
285 mLockColorAction->setCheckable(
true );
286 mLockColorAction->setIcon( iconColorLock );
288 QIcon iconSelectLock;
289 iconSelectLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconSelectLocked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
290 iconSelectLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconSelectLocked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
291 iconSelectLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconSelectUnlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
292 iconSelectLock.addFile(
QgsApplication::iconPath( QStringLiteral(
"mIconSelectUnlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
294 mLockSelectionColorAction =
new QAction( tr(
"Lock Color When Selected" ),
this );
295 mLockSelectionColorAction->setToolTip( tr(
"Avoid changing the color of the layer when a feature is selected" ) );
296 mLockSelectionColorAction->setCheckable(
true );
297 mLockSelectionColorAction->setIcon( iconSelectLock );
299 QMenu *lockMenu =
new QMenu(
this );
300 lockMenu->addAction( mLockColorAction );
301 lockMenu->addAction( mLockSelectionColorAction );
302 btnLock->setMenu( lockMenu );
303 btnLock->setPopupMode( QToolButton::InstantPopup );
309 mSymbolLayersModel =
new QStandardItemModel( layersTree );
311 layersTree->setModel( mSymbolLayersModel );
312 layersTree->setHeaderHidden(
true );
324 mPreviewExpressionContext.setFeature( mPreviewFeature );
332 QItemSelectionModel *selModel = layersTree->selectionModel();
335 loadSymbol( mSymbol,
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
343 connect( mLockSelectionColorAction, &QAction::toggled,
this, [
this](
bool checked ) {
351 updateLockButtonIcon();
357 updateLockButtonIcon();
362 const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
363 layersTree->setCurrentIndex( newIndex );
392 widget->mOwnedSymbol = std::move(
symbol );
398 if ( !mAdvancedMenu )
400 mAdvancedMenu =
new QMenu(
this );
404 return mAdvancedMenu;
411 if (
auto *lExpressionContext = mContext.expressionContext() )
413 mPreviewExpressionContext = *lExpressionContext;
417 mPreviewExpressionContext.setFeature( mPreviewFeature );
420 QWidget *widget = stackedWidget->currentWidget();
423 layerProp->setContext(
context );
427 listWidget->setContext(
context );
447 mSymbolLayersModel->clear();
448 parent =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() );
451 SymbolLayerItem *symbolItem =
new SymbolLayerItem(
symbol, mVectorLayer, screen() );
452 QFont boldFont = symbolItem->font();
453 boldFont.setBold(
true );
454 symbolItem->setFont( boldFont );
455 parent->appendRow( symbolItem );
457 const int count =
symbol->symbolLayerCount();
458 for (
int i = count - 1; i >= 0; i-- )
460 SymbolLayerItem *layerItem =
new SymbolLayerItem(
symbol->symbolLayer( i ),
symbol->type(), mVectorLayer, screen() );
461 layerItem->setEditable(
false );
462 symbolItem->appendRow( layerItem );
463 if (
symbol->symbolLayer( i )->subSymbol() )
467 layersTree->setExpanded( layerItem->index(),
true );
469 layersTree->setExpanded( symbolItem->index(),
true );
471 if ( mSymbol ==
symbol && !layersTree->currentIndex().isValid() )
474 layersTree->setCurrentIndex( symbolItem->index() );
478void QgsSymbolSelectorWidget::reloadSymbol()
480 mSymbolLayersModel->clear();
481 loadSymbol( mSymbol,
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
484void QgsSymbolSelectorWidget::updateUi()
486 const QModelIndex currentIdx = layersTree->currentIndex();
487 if ( !currentIdx.isValid() )
490 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( currentIdx ) );
491 if ( !item->isLayer() )
493 btnUp->setEnabled(
false );
494 btnDown->setEnabled(
false );
495 btnRemoveLayer->setEnabled(
false );
496 btnLock->setEnabled(
false );
497 btnDuplicate->setEnabled(
false );
501 const int rowCount = item->parent()->rowCount();
502 const int currentRow = item->row();
504 btnUp->setEnabled( currentRow > 0 );
505 btnDown->setEnabled( currentRow < rowCount - 1 );
506 btnRemoveLayer->setEnabled( rowCount > 1 );
507 btnLock->setEnabled(
true );
508 btnDuplicate->setEnabled(
true );
516 std::unique_ptr<QgsSymbol> symbolClone( mSymbol->clone() );
518 lblPreview->setPixmap( QPixmap::fromImage( preview ) );
520 if ( !mBlockModified )
527 SymbolLayerItem *item = currentLayerItem();
529 item->updatePreview();
534SymbolLayerItem *QgsSymbolSelectorWidget::currentLayerItem()
536 const QModelIndex idx = layersTree->currentIndex();
537 if ( !idx.isValid() )
540 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
541 if ( !item->isLayer() )
549 const QModelIndex idx = layersTree->currentIndex();
550 if ( !idx.isValid() )
553 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
554 if ( item->isLayer() )
555 return item->layer();
564 SymbolLayerItem *currentItem =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
568 if ( currentItem->isLayer() )
570 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( currentItem->parent() );
571 mDataDefineRestorer = std::make_unique<DataDefinedRestorer>( parent->symbol(), currentItem->layer() );
575 setWidget( layerProp );
586 mDataDefineRestorer.reset();
588 currentItem->symbol()->setLayer( mVectorLayer );
592 symbolsList->setContext( mContext );
594 setWidget( symbolsList );
602 SymbolLayerItem *currentItem =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
603 if ( !currentItem || currentItem->isLayer() )
607 if ( currentItem->parent() )
611 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( currentItem->parent() );
612 parent->removeRow( 0 );
614 layersTree->setCurrentIndex( parent->child( 0 )->index() );
615 parent->updatePreview();
621 const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
622 layersTree->setCurrentIndex( newIndex );
629void QgsSymbolSelectorWidget::setWidget( QWidget *widget )
631 const int index = stackedWidget->addWidget( widget );
632 stackedWidget->setCurrentIndex( index );
633 if ( mPresentWidget )
634 mPresentWidget->deleteLater();
635 mPresentWidget = widget;
638void QgsSymbolSelectorWidget::updateLockButton()
640 QgsSymbolLayer *layer = currentLayer();
643 mLockColorAction->setChecked( layer->
isLocked() );
646 updateLockButtonIcon();
649void QgsSymbolSelectorWidget::updateLockButtonIcon()
651 if ( mLockColorAction->isChecked() && mLockSelectionColorAction->isChecked() )
653 else if ( mLockColorAction->isChecked() )
655 else if ( mLockSelectionColorAction->isChecked() )
663 const QModelIndex idx = layersTree->currentIndex();
664 if ( !idx.isValid() )
668 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
669 if ( item->isLayer() )
671 insertIdx = item->row();
672 item =
static_cast<SymbolLayerItem *
>( item->parent() );
675 QgsSymbol *parentSymbol = item->symbol();
685 newLayerPtr = newLayer.get();
686 if ( insertIdx == -1 )
689 parentSymbol->
insertSymbolLayer( item->rowCount() - insertIdx, newLayer.release() );
694 static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedSize( ddSize );
696 static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedAngle( ddAngle );
698 static_cast<QgsLineSymbol *
>( parentSymbol )->setDataDefinedWidth( ddWidth );
702 SymbolLayerItem *newLayerItem =
new SymbolLayerItem( newLayerPtr, parentSymbol->
type(), mVectorLayer, screen() );
703 item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
704 item->updatePreview();
706 layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
713 SymbolLayerItem *item = currentLayerItem();
714 const int row = item->row();
715 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( item->parent() );
717 const int layerIdx = parent->rowCount() - row - 1;
718 QgsSymbol *parentSymbol = parent->symbol();
721 parent->removeRow( row );
722 parent->updatePreview();
724 const QModelIndex newIdx = parent->child( 0 )->index();
725 layersTree->setCurrentIndex( newIdx );
735 moveLayerByOffset( +1 );
740 moveLayerByOffset( -1 );
743void QgsSymbolSelectorWidget::moveLayerByOffset(
int offset )
745 SymbolLayerItem *item = currentLayerItem();
748 const int row = item->row();
750 SymbolLayerItem *parent =
static_cast<SymbolLayerItem *
>( item->parent() );
751 QgsSymbol *parentSymbol = parent->symbol();
753 const int layerIdx = parent->rowCount() - row - 1;
758 QList<QStandardItem *> rowItems = parent->takeRow( row );
759 parent->insertRows( row + offset, rowItems );
760 parent->updatePreview();
762 const QModelIndex newIdx = rowItems[0]->index();
763 layersTree->setCurrentIndex( newIdx );
774 layer->
setLocked( mLockColorAction->isChecked() );
775 updateLockButtonIcon();
781 const QModelIndex idx = layersTree->currentIndex();
782 if ( !idx.isValid() )
785 SymbolLayerItem *item =
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
786 if ( !item->isLayer() )
791 const int insertIdx = item->row();
792 item =
static_cast<SymbolLayerItem *
>( item->parent() );
794 QgsSymbol *parentSymbol = item->symbol();
798 if ( insertIdx == -1 )
803 SymbolLayerItem *newLayerItem =
new SymbolLayerItem( newLayer, parentSymbol->
type(), mVectorLayer, screen() );
804 item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
808 layersTree->setExpanded( newLayerItem->index(),
true );
810 item->updatePreview();
812 layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
819 SymbolLayerItem *item = currentLayerItem();
821 if ( item->rowCount() > 0 )
823 item->removeRow( 0 );
825 QgsSymbol *
symbol =
static_cast<SymbolLayerItem *
>( item->parent() )->symbol();
828 item->setLayer( newLayer,
symbol->type() );
833 layersTree->setExpanded( item->index(),
true );
837 const int layerIdx = item->parent()->rowCount() - item->row() - 1;
838 symbol->changeSymbolLayer( layerIdx, newLayer );
840 item->updatePreview();
849 setLayout(
new QVBoxLayout() );
852 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
854 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
855 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
856 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, &QgsSymbolSelectorDialog::showHelp );
858 layout()->addWidget( mSelectorWidget );
859 layout()->addWidget( mButtonBox );
863 mSelectorWidget->setMinimumSize( 460, 560 );
864 setObjectName( QStringLiteral(
"SymbolSelectorDialog" ) );
871 layout()->setContentsMargins( 0, 0, 0, 0 );
875 setWindowTitle( tr(
"Symbol Selector" ) );
877 mSelectorWidget->setDockMode( embedded );
882 return mSelectorWidget->advancedMenu();
887 mSelectorWidget->setContext(
context );
892 return mSelectorWidget->context();
897 return mSelectorWidget->symbol();
903 if ( !isWindow() && e->key() == Qt::Key_Escape )
909 QDialog::keyPressEvent( e );
913void QgsSymbolSelectorDialog::reloadSymbol()
915 mSelectorWidget->reloadSymbol();
920 mSelectorWidget->loadSymbol(
symbol, parent );
923void QgsSymbolSelectorDialog::updateUi()
925 mSelectorWidget->updateUi();
928void QgsSymbolSelectorDialog::updateLockButton()
930 mSelectorWidget->updateLockButton();
933SymbolLayerItem *QgsSymbolSelectorDialog::currentLayerItem()
935 return mSelectorWidget->currentLayerItem();
940 return mSelectorWidget->currentLayer();
943void QgsSymbolSelectorDialog::moveLayerByOffset(
int offset )
945 mSelectorWidget->moveLayerByOffset( offset );
948void QgsSymbolSelectorDialog::setWidget( QWidget *widget )
950 mSelectorWidget->setWidget( widget );
955 mSelectorWidget->moveLayerDown();
960 mSelectorWidget->moveLayerUp();
965 mSelectorWidget->addLayer();
970 mSelectorWidget->removeLayer();
975 mSelectorWidget->lockLayer();
980 mSelectorWidget->duplicateLayer();
985 mSelectorWidget->layerChanged();
990 mSelectorWidget->updateLayerPreview();
995 mSelectorWidget->updatePreview();
1000 mSelectorWidget->symbolChanged();
1005 mSelectorWidget->changeLayer( layer );
1013void QgsSymbolSelectorDialog::showHelp()
1018void QgsSymbolSelectorWidget::projectDataChanged()
1020 mBlockModified =
true;
1023 mBlockModified =
false;
1026void QgsSymbolSelectorWidget::layersAboutToBeRemoved(
const QList<QgsMapLayer *> &layers )
1028 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