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. |
|
Methods
Returns the current color for the dialog |
|
Sets whether opacity modification (transparency) is permitted for the color dialog. |
|
Sets the current color for the dialog |
|
Sets whether color model is editable or not |
|
Sets whether the widget's color has been "discarded" and the selected color should not be stored in the recent color list. |
|
Sets the color to show in an optional "previous color" section |
Static Methods
Triggers a user prompt for creating a new user color scheme. |
|
Triggers a user prompt for importing a new color scheme from an existing GPL file. |
|
Triggers a user prompt for removing an existing user color scheme. |
Signals
Emitted when the dialog's color changes |
Attributes
- 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
parent
argument 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(color: QColor)[source]¶
Emitted when the dialog’s color changes
- Parameters:
color (QColor) – current color
- static importUserPaletteFromFile(parent: QWidget | None) QgsUserColorScheme | None [source]¶
Triggers a user prompt for importing a new color scheme from an existing GPL file.
The
parent
argument 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
parent
argument 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
False
to 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
False
to disable color model modification Defaults toTrue
.
Added in version 3.40.