Class: QgsColorSwatchGrid¶
- class qgis.gui.QgsColorSwatchGrid¶
Bases:
PyQt5.QtWidgets.QWidget
A grid of color swatches, which allows for user selection. Colors are taken from an associated
QgsColorScheme
.See also
QgsColorGridAction
New in version 2.5.
QgsColorSwatchGrid(scheme:
QgsColorScheme
, context: str = ‘’, parent: QWidget = None) Construct a new color swatch grid.- Parameters
scheme –
QgsColorScheme
for colors to show in gridcontext – context string provided to color scheme
parent –
parent widget
Methods
Gets the base color for the widget
Gets the list of colors shown in the grid
Gets the current context for the grid
- param event
- param event
- param event
- rtype
QSize
- param event
- param event
- param event
- param event
Reload colors from scheme and redraws the widget
Sets the base color for the widget
Sets the current context for the grid
- rtype
QSize
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- actionEvent(self, QActionEvent)¶
- baseColor(self) QColor ¶
Gets the base color for the widget
- Return type
QColor
- Returns
base color which is passed to scheme for color generation
See also
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, QCloseEvent)¶
- 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
- colors(self) List[Tuple[QColor, str]] ¶
Gets the list of colors shown in the grid
- Return type
List[Tuple[QColor, str]]
- Returns
list of colors currently shown in the grid
- connectNotify(self, QMetaMethod)¶
- context(self) str ¶
Gets the current context for the grid
- Return type
str
- Returns
context string which is passed to scheme for color generation
See also
- contextMenuEvent(self, QContextMenuEvent)¶
- create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)¶
- customEvent(self, QEvent)¶
- destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)¶
- disconnectNotify(self, QMetaMethod)¶
- dragEnterEvent(self, QDragEnterEvent)¶
- dragLeaveEvent(self, QDragLeaveEvent)¶
- dragMoveEvent(self, QDragMoveEvent)¶
- dropEvent(self, QDropEvent)¶
- enterEvent(self, QEvent)¶
- event(self, QEvent) bool ¶
- focusInEvent(self, event: QFocusEvent)¶
- Parameters
event (QFocusEvent) –
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, event: QFocusEvent)¶
- Parameters
event (QFocusEvent) –
- focusPreviousChild(self) bool ¶
- hideEvent(self, QHideEvent)¶
- hovered¶
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
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, event: QKeyEvent)¶
- Parameters
event (QKeyEvent) –
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- minimumSizeHint(self) QSize ¶
- Return type
QSize
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- mousePressEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- mouseReleaseEvent(self, event: QMouseEvent)¶
- Parameters
event (QMouseEvent) –
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, event: QPaintEvent)¶
- Parameters
event (QPaintEvent) –
- receivers(self, PYQT_SIGNAL) int ¶
- refreshColors(self)¶
Reload colors from scheme and redraws the widget
- resizeEvent(self, QResizeEvent)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setBaseColor(self, baseColor: Union[QColor, Qt.GlobalColor, QGradient])¶
Sets the base color for the widget
- 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 grid
- Parameters
context (str) – string which is passed to scheme for color generation
See also
- showEvent(self, QShowEvent)¶
- sizeHint(self) QSize ¶
- Return type
QSize
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- wheelEvent(self, QWheelEvent)¶