Class: QgsCompoundColorWidget

class qgis.gui.QgsCompoundColorWidget

Bases: QgsPanelWidget

A custom QGIS widget for selecting a color, including options for selecting colors via hue wheel, color swatches, and a color sampler.

QgsCompoundColorWidget(parent: QWidget = None, color: Union[QColor, Qt.GlobalColor, QGradient] = QColor(), layout: QgsCompoundColorWidget.Layout = QgsCompoundColorWidget.LayoutDefault) Constructor for QgsCompoundColorWidget

Parameters:
class Layout

Bases: int

LayoutDefault = 0
LayoutVertical = 1
actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
color(self) QColor

Returns the current color for the dialog

Return type:

QColor

Returns:

dialog color

connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: PyQt5.sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
createNewUserPalette(parent: QWidget) QgsUserColorScheme

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.

New in version 3.2.

Parameters:

parent (QWidget) –

Return type:

QgsUserColorScheme

currentColorChanged

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

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, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, e: QHideEvent)
Parameters:

e (QHideEvent) –

importUserPaletteFromFile(parent: QWidget) QgsUserColorScheme

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.

New in version 3.2.

Parameters:

parent (QWidget) –

Return type:

QgsUserColorScheme

initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, e: QKeyEvent)
Parameters:

e (QKeyEvent) –

keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, e: QMouseEvent)
Parameters:

e (QMouseEvent) –

mousePressEvent(self, e: QMouseEvent)
Parameters:

e (QMouseEvent) –

mouseReleaseEvent(self, e: QMouseEvent)
Parameters:

e (QMouseEvent) –

moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
removeUserPalette(scheme: QgsUserColorScheme, parent: QWidget) bool

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.

New in version 3.2.

Parameters:
Return type:

bool

resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
setAllowOpacity(self, allowOpacity: bool)

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 | QGradient)

Sets the current color for the dialog

Parameters:

color (Union[QColor) – desired color

setDiscarded(self, discarded: bool)

Sets whether the widget’s color has been “discarded” and the selected color should not be stored in the recent color list.

Parameters:

discarded (bool) – set to True to avoid adding color to recent color list on widget destruction.

setPreviousColor(self, color: QColor | Qt.GlobalColor | QGradient)

Sets the color to show in an optional “previous color” section

Parameters:

color (Union[QColor) – previous color

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)