Class: QgsCompoundColorWidget¶
A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel, color swatches, and a color sampler.
Class Hierarchy¶
Base classes¶
Base class for any widget that can be shown as an inline panel. |
|
- class qgis.gui.QgsCompoundColorWidget[source]¶
Bases:
QgsPanelWidget- __init__(parent: QWidget | None = None, color: QColor | Qt.GlobalColor = QColor(), layout: QgsCompoundColorWidget.Layout = QgsCompoundColorWidget.LayoutDefault)
Constructor for QgsCompoundColorWidget
- Parameters:
parent (Optional[QWidget] = None) – parent widget
color (Union[QColor, Qt.GlobalColor] = QColor()) – initial color for dialog
layout (QgsCompoundColorWidget.Layout = QgsCompoundColorWidget.LayoutDefault) – widget layout to use
- class Layout¶
Bases:
int
- LayoutDefault = 0¶
- LayoutVertical = 1¶
- color(self) QColor[source]¶
Returns the current color for the dialog
- Return type:
QColor
- Returns:
dialog color
- static createNewUserPalette(parent: QWidget | None) QgsUserColorScheme | None[source]¶
Triggers a user prompt for creating a new user color scheme.
The
parentargument must be set to a valid parent widget for the dialog prompts.See also
See also
Added in version 3.2.
- Parameters:
parent (Optional[QWidget])
- Return type:
Optional[QgsUserColorScheme]
- signal currentColorChanged[source]¶
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.
- static importUserPaletteFromFile(parent: QWidget | None) QgsUserColorScheme | None[source]¶
Triggers a user prompt for importing a new color scheme from an existing GPL file.
The
parentargument must be set to a valid parent widget for the dialog prompts.See also
See also
Added in version 3.2.
- Parameters:
parent (Optional[QWidget])
- Return type:
Optional[QgsUserColorScheme]
- static removeUserPalette(scheme: QgsUserColorScheme | None, parent: QWidget | None) bool[source]¶
Triggers a user prompt for removing an existing user color
scheme.The
parentargument must be set to a valid parent widget for the dialog prompts.See also
See also
Added in version 3.2.
- Parameters:
scheme (Optional[QgsUserColorScheme])
parent (Optional[QWidget])
- Return type:
bool
- setAllowOpacity(self, allowOpacity: bool)[source]¶
Sets whether opacity modification (transparency) is permitted for the color dialog. Defaults to
True.- Parameters:
allowOpacity (bool) – set to
Falseto disable opacity modification
- setColor(self, color: QColor | Qt.GlobalColor)[source]¶
Sets the current color for the dialog
- Parameters:
color (Union[QColor, Qt.GlobalColor]) – desired color
- setColorModelEditable(self, colorModelEditable: bool)[source]¶
Sets whether color model is editable or not
- Parameters:
colorModelEditable (bool) – set to
Falseto disable color model modification Defaults toTrue.
Added in version 3.40.