Class: QgsColorSliderWidget

class qgis.gui.QgsColorSliderWidget(parent: QWidget = None, component: QgsColorWidget.ColorComponent = QgsColorWidget.Red)

Bases: QgsColorWidget

Construct a new color slider widget.

  • parent (QWidget = None) – parent QWidget for the widget

  • component (QgsColorWidget.ColorComponent = QgsColorWidget.Red) – color component which is controlled by the slider

A composite horizontal color ramp widget and associated spinbox for manual value entry.

actionEvent(self, QActionEvent)
alterColor(self, color: Union[QColor, Qt.GlobalColor, QGradient], component: QgsColorWidget.ColorComponent, newValue: int)

Alters a color by modifiying the value of a specific color component

  • color – color to alter

  • component – color component to alter

  • newValue – new value of color component. Values are automatically clipped to a valid range for the color component.

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
componentRange(self) → int

Returns the range of valid values for the color widget’s component


maximum value allowed for color component, or -1 if widget has multiple components

componentRange(self, component: QgsColorWidget.ColorComponent) -> int Returns the range of valid values a color component


maximum value allowed for color component

componentValue(self) → int

Returns the current value of the widget’s color component


value of color component, or -1 if widget has multiple components or an invalid color set

See also


componentValue(self, component: QgsColorWidget.ColorComponent) -> int Returns the value of a component of the widget’s current color. This method correctly handles hue values when the color has an ambiguous hue (e.g., black or white shades)


component – color component to return


value of color component, or -1 if widget has an invalid color set

See also


connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: 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, e: QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, e: 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, QHideEvent)
hue(self) → int

Returns the hue for the widget. This may differ from the hue for the QColor returned by color(), as QColor returns a hue of -1 if the color’s hue is ambiguous (e.g., if the saturation is zero).


explicitly set hue for widget

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, e: QMouseEvent)
mousePressEvent(self, e: QMouseEvent)
mouseReleaseEvent(self, e: QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) → int
resizeEvent(self, QResizeEvent)
sender(self) → QObject
senderSignalIndex(self) → int
setColor(self, color: Union[QColor, Qt.GlobalColor, QGradient], emitSignals: bool = False)
  • color (Union[QColor) –

  • emitSignals (bool = False) –

setComponent(self, component: QgsColorWidget.ColorComponent)

component (QgsColorWidget.ColorComponent) –

setComponentValue(self, value: int)

value (int) –

sharedPainter(self) → QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
transparentBackground() → QPixmap

Generates a checkboard pattern pixmap for use as a background to transparent colors


checkerboard pixmap

wheelEvent(self, QWheelEvent)