QgsSymbolSelectorWidget class

Symbol selector widget that can be used to select and build a symbol.

Base classes

class QgsPanelWidget
Base class for any widget that can be shown as a inline panel.

Constructors, destructors, conversion operators

QgsSymbolSelectorWidget(QgsSymbol* symbol, QgsStyle* style, QgsVectorLayer* vl, QWidget* parent = nullptr)
Symbol selector widget that can be used to select and build a symbol.

Public functions

auto advancedMenu() -> QMenu*
Returns menu for "advanced" button - create it if doesn't exist and show the advanced button.
auto context() const -> QgsSymbolWidgetContext
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
void setContext(const QgsSymbolWidgetContext& context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.
auto symbol() -> QgsSymbol*
Returns the symbol that is currently active in the widget.

Signals

void symbolModified()
Emiited when a symbol is modified in the widget.

Public slots

void addLayer()
Add a symbol layer to the bottom of the stack.
void changeLayer(QgsSymbolLayer* layer)
alters tree and sets proper widget when Layer Type is changed
void duplicateLayer()
Duplicates the current symbol layer and places the duplicated layer above the current symbol layer.
void layerChanged()
Called when the layer changes in the widget.
void lockLayer()
Lock the current active symbol layer.
void moveLayerDown()
Move the active symbol layer down.
void moveLayerUp()
Move the active symbol layer up.
void removeLayer()
Remove the current active symbol layer.
void symbolChanged()
Slot to update tree when a new symbol from style.
void updateLayerPreview()
Update the single symbol layer preview in the widget.
void updatePreview()
Update the preview of the whole symbol in the interface.

Protected functions

auto currentLayer() -> QgsSymbolLayer*
The current symbol layer that is active in the interface.
auto currentLayerItem() -> SymbolLayerItem*
void loadSymbol()
Reload the current symbol in the view.
void loadSymbol(QgsSymbol* symbol, SymbolLayerItem* parent)
Load the given symbol into the widget.
void moveLayerByOffset(int offset)
Move the current active layer by a set offset in the list.
void setWidget(QWidget* widget)
Set the properties widget for the active symbol layer.
void updateLockButton()
Update the lock button states based on the current symbol layer.
void updateUi()
Update the state of the UI based on the currently set symbol layer.

Function documentation

QgsSymbolSelectorWidget::QgsSymbolSelectorWidget(QgsSymbol* symbol, QgsStyle* style, QgsVectorLayer* vl, QWidget* parent = nullptr)

Symbol selector widget that can be used to select and build a symbol.

Parameters
symbol The symbol to load into the widget as a start point.
style The style used by the widget.
vl The vector layer for the symbol.
parent

QgsSymbolWidgetContext QgsSymbolSelectorWidget::context() const

Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.

void QgsSymbolSelectorWidget::setContext(const QgsSymbolWidgetContext& context)

Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression contexts.

Parameters
context symbol widget context

QgsSymbol* QgsSymbolSelectorWidget::symbol()

Returns the symbol that is currently active in the widget.

Returns The active symbol.

Can be null.

void QgsSymbolSelectorWidget::changeLayer(QgsSymbolLayer* layer) public slot

alters tree and sets proper widget when Layer Type is changed

void QgsSymbolSelectorWidget::duplicateLayer() public slot

Duplicates the current symbol layer and places the duplicated layer above the current symbol layer.

void QgsSymbolSelectorWidget::layerChanged() public slot

Called when the layer changes in the widget.

Updates the active properties for active symbol layer.

QgsSymbolLayer* QgsSymbolSelectorWidget::currentLayer() protected

The current symbol layer that is active in the interface.

Returns The active symbol layer.

SymbolLayerItem* QgsSymbolSelectorWidget::currentLayerItem() protected

void QgsSymbolSelectorWidget::loadSymbol(QgsSymbol* symbol, SymbolLayerItem* parent) protected

Load the given symbol into the widget.

Parameters
symbol The symbol to load.
parent The parent symbol layer item.

void QgsSymbolSelectorWidget::moveLayerByOffset(int offset) protected

Move the current active layer by a set offset in the list.

Parameters
offset The offset to move the layer by

void QgsSymbolSelectorWidget::setWidget(QWidget* widget) protected

Set the properties widget for the active symbol layer.

Parameters
widget The widget to set to configure the active symbol layer.