Class: QgsColorSwatchGridAction¶
- class qgis.gui.QgsColorSwatchGridAction¶
Bases:
PyQt5.QtWidgets.QWidgetAction
A color swatch grid which can be embedded into a menu.
See also
New in version 2.5.
QgsColorSwatchGridAction(scheme:
QgsColorScheme
, menu: QMenu = None, context: str = ‘’, parent: QWidget = None) Construct a new color swatch grid action.- Parameters:
scheme –
QgsColorScheme
for colors to show in gridmenu – parent menu
context – context string provided to color scheme
parent –
parent widget
Methods
Gets the base color for the color grid
Gets the current context for the color grid
Returns whether the parent menu will be dismissed after a color is selected from the action's color widget.
Reload colors from scheme and redraws the widget
Sets the base color for the color grid
Sets the current context for the color grid
Sets whether the parent menu should be dismissed and closed when a color is selected from the action's color widget.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- baseColor(self) QColor ¶
Gets the base color for the color grid
- Return type:
QColor
- Returns:
base color which is passed to scheme for color generation
See also
- childEvent(self, QChildEvent)¶
- colorChanged¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- connectNotify(self, QMetaMethod)¶
- context(self) str ¶
Gets the current context for the color grid
- Return type:
str
- Returns:
context string which is passed to scheme for color generation
See also
- createWidget(self, QWidget) QWidget ¶
- createdWidgets(self) List[QWidget] ¶
- customEvent(self, QEvent)¶
- deleteWidget(self, QWidget)¶
- disconnectNotify(self, QMetaMethod)¶
- dismissOnColorSelection(self) bool ¶
Returns whether the parent menu will be dismissed after a color is selected from the action’s color widget.
See also
New in version 2.14.
- Return type:
bool
- event(self, QEvent) bool ¶
- eventFilter(self, QObject, QEvent) bool ¶
- isSignalConnected(self, QMetaMethod) bool ¶
- receivers(self, PYQT_SIGNAL) int ¶
- refreshColors(self)¶
Reload colors from scheme and redraws the widget
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setBaseColor(self, baseColor: QColor | Qt.GlobalColor | QGradient)¶
Sets the base color for the color grid
- Parameters:
baseColor (Union[QColor) – base color to pass to scheme for color generation
See also
- setContext(self, context: str)¶
Sets the current context for the color grid
- Parameters:
context (str) – string which is passed to scheme for color generation
See also
- 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.
- Parameters:
dismiss (bool) – set to
True
(default) to immediately close the menu when a color is selected from the widget. If set toFalse
, the colorChanged signal will be emitted but the menu will stay open.
See also
New in version 2.14.
- timerEvent(self, QTimerEvent)¶