QgsPropertyAssistantWidget class

Shows a user-friendly assistant guiding users through the creation of QgsProperty overrides.

Base classes

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

Constructors, destructors, conversion operators

QgsPropertyAssistantWidget(QWidget* parent = nullptr, const QgsPropertyDefinition& definition = QgsPropertyDefinition(), const QgsProperty& initialState = QgsProperty(), const QgsVectorLayer* layer = nullptr)
Constructor for QgsPropertyAssistantWidget.

Public functions

void registerExpressionContextGenerator(QgsExpressionContextGenerator* generator)
Register an expression context generator class that will be used to retrieve an expression context for the button when required.
void setDockMode(bool dockMode) override
Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.
void setSymbol(std::shared_ptr<QgsSymbol> symbol)
Sets a symbol which can be used for previews inside the widget.
void updateProperty(QgsProperty& property)
Updates a property in place to corresponding to the current settings shown in the widget.

Function documentation

QgsPropertyAssistantWidget::QgsPropertyAssistantWidget(QWidget* parent = nullptr, const QgsPropertyDefinition& definition = QgsPropertyDefinition(), const QgsProperty& initialState = QgsProperty(), const QgsVectorLayer* layer = nullptr)

Constructor for QgsPropertyAssistantWidget.

Aside from a parent widget, the constructor accepts a corresponding property definition from which it customizes the displayed options (eg a color based property definition will show an assistant to allow creation of color based properties). The initialState dictates the initial state to show in the widget. A corresponding layer can also be set to allow population of GUI widgets such as field selectors.

void QgsPropertyAssistantWidget::setDockMode(bool dockMode) override

Set the widget in dock mode which tells the widget to emit panel widgets and not open dialogs.

Parameters
dockMode True to enable dock mode.

void QgsPropertyAssistantWidget::setSymbol(std::shared_ptr<QgsSymbol> symbol)

Sets a symbol which can be used for previews inside the widget.

If not specified, default created symbols will be used instead.