Class: QgsColorDialog¶
- class qgis.gui.QgsColorDialog¶
Bases:
PyQt5.QtWidgets.QDialog
A custom QGIS dialog for selecting a color. Has many improvements over the standard Qt color picker dialog, including hue wheel supports, color swatches, and a color sampler.
New in version 2.5.
QgsColorDialog(parent: QWidget = None, fl: Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags, color: Union[QColor, Qt.GlobalColor, QGradient] = QColor()) Create a new color picker dialog
- Parameters:
parent – parent widget
fl – window flags
color –
initial color for dialog
Methods
- param e:
Returns the current color for the dialog
Returns a color selection from a color dialog.
Sets whether opacity modification (transparency) is permitted for the color dialog.
Sets the current color for the dialog
Sets the title for the color dialog
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- actionEvent(self, QActionEvent)¶
- changeEvent(self, QEvent)¶
- childEvent(self, QChildEvent)¶
- closeEvent(self, e: QCloseEvent)¶
- Parameters:
e (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)¶
- 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 ¶
- eventFilter(self, QObject, QEvent) bool ¶
- focusInEvent(self, QFocusEvent)¶
- focusNextChild(self) bool ¶
- focusNextPrevChild(self, bool) bool ¶
- focusOutEvent(self, QFocusEvent)¶
- focusPreviousChild(self) bool ¶
- getColor(initialColor: QColor | Qt.GlobalColor | QGradient, parent: QWidget, title: str = '', allowOpacity: bool = False) QColor ¶
Returns a color selection from a color dialog.
- Parameters:
initialColor (Union[QColor) – the initial color of the selection dialog.
parent (QWidget) – parent widget
title (str = '') – the title of the dialog.
allowOpacity (bool = False) – set to
True
to allow modification of color opacity value (transparency)
- Return type:
QColor
- Returns:
Selected color on
accepted()
or initialColor onrejected()
.
- hideEvent(self, QHideEvent)¶
- initPainter(self, QPainter)¶
- inputMethodEvent(self, QInputMethodEvent)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
- metric(self, QPaintDevice.PaintDeviceMetric) int ¶
- mouseDoubleClickEvent(self, QMouseEvent)¶
- mouseMoveEvent(self, QMouseEvent)¶
- mousePressEvent(self, QMouseEvent)¶
- mouseReleaseEvent(self, QMouseEvent)¶
- moveEvent(self, QMoveEvent)¶
- nativeEvent(self, Union[QByteArray, bytes, bytearray], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- receivers(self, PYQT_SIGNAL) int ¶
- 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
New in version 3.0.
- setColor(self, color: QColor | Qt.GlobalColor | QGradient)¶
Sets the current color for the dialog
- Parameters:
color (Union[QColor) – desired color
- setTitle(self, title: str)¶
Sets the title for the color dialog
- Parameters:
title (str) – title for dialog box
- showEvent(self, QShowEvent)¶
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- wheelEvent(self, QWheelEvent)¶