Class: QgsColorWidgetAction

class qgis.gui.QgsColorWidgetAction

Bases: PyQt5.QtWidgets.QWidgetAction

An action containing a color widget, which can be embedded into a menu.

See also


QgsColorWidgetAction(colorWidget: Optional[QgsColorWidget], menu: Optional[QMenu] = None, parent: Optional[QWidget] = None) Construct a new color widget action.

childEvent(self, a0: QChildEvent | None)

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

  • name (str = ...)

  • revision (int = ...)

  • arguments (Sequence = ...)

Return type:


colorWidget(self) QgsColorWidget | None

Returns the color widget contained in the widget action.

Return type:


connectNotify(self, signal: QMetaMethod)
createWidget(self, parent: QWidget | None) QWidget | None
createdWidgets(self) List[QWidget]
customEvent(self, a0: QEvent | None)
deleteWidget(self, widget: QWidget | None)
disconnectNotify(self, signal: QMetaMethod)
dismissOnColorSelection(self) bool

Returns whether the parent menu will be dismissed after a color is selected from the action’s color widget.

Return type:


event(self, a0: QEvent | None) bool
eventFilter(self, a0: QObject | None, a1: QEvent | None) bool
isSignalConnected(self, signal: QMetaMethod) bool
receivers(self, signal: PYQT_SIGNAL) int
sender(self) QObject | None
senderSignalIndex(self) int
setDismissOnColorSelection(self, dismiss: bool)

Sets whether the parent menu should be dismissed and closed when a color is selected from the action’s color widget.


dismiss (bool) – 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.

timerEvent(self, a0: QTimerEvent | None)