QgsColorWidgetAction class
An action containing a color widget, which can be embedded into a menu.
Contents
Constructors, destructors, conversion operators
- QgsColorWidgetAction(QgsColorWidget* colorWidget, QMenu* menu = nullptr, QWidget* parent = nullptr)
- Construct a new color widget action.
Public functions
- auto colorWidget() -> QgsColorWidget*
- Returns the color widget contained in the widget action.
- auto dismissOnColorSelection() const -> bool
- Returns whether the parent menu will be dismissed after a color is selected from the action's color widget.
- void setDismissOnColorSelection(bool dismiss)
- Sets whether the parent menu should be dismissed and closed when a color is selected from the action's color widget.
Signals
- void colorChanged(const QColor& color)
- Emitted when a color has been selected from the widget.
Function documentation
QgsColorWidgetAction:: QgsColorWidgetAction(QgsColorWidget* colorWidget,
QMenu* menu = nullptr,
QWidget* parent = nullptr)
Construct a new color widget action.
| Parameters | |
|---|---|
| colorWidget | QgsColorWidget to show in action |
| menu | parent menu |
| parent | parent widget |
bool QgsColorWidgetAction:: dismissOnColorSelection() const
Returns whether the parent menu will be dismissed after a color is selected from the action's color widget.
void QgsColorWidgetAction:: setDismissOnColorSelection(bool dismiss)
Sets whether the parent menu should be dismissed and closed when a color is selected from the action's color widget.
| Parameters | |
|---|---|
| dismiss | set to true (default) to immediately close the menu when a color is selected from the widget. If set to false, the colorChanged signal will be emitted but the menu will stay open. |
void QgsColorWidgetAction:: colorChanged(const QColor& color) signal
Emitted when a color has been selected from the widget.
| Parameters | |
|---|---|
| color | selected color |