Class: QgsGradientStopEditor

class qgis.gui.QgsGradientStopEditor

Bases: PyQt5.QtWidgets.QWidget

An interactive editor for previewing a gradient color ramp and modifying the position of color stops along the gradient.

New in version 2.16.

QgsGradientStopEditor(parent: QWidget = None, ramp: QgsGradientColorRamp = None) Constructor for QgsGradientStopEditor.

Parameters
actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
changed

Emitted when the gradient ramp is changed by a user [signal]

childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
deleteSelectedStop(self)

Deletes the current selected stop. This slot has no effect if either the first or last stop is selected, as they cannot be deleted.

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, e: QDragEnterEvent)
Parameters

e (QDragEnterEvent) –

dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, e: QDropEvent)
Parameters

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
gradientRamp(self) QgsGradientColorRamp

Returns the current ramp created by the editor.

Return type

QgsGradientColorRamp

hideEvent(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, event: QKeyEvent)
Parameters

event (QKeyEvent) –

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

event (QMouseEvent) –

mouseMoveEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mousePressEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
paintEvent(self, event: QPaintEvent)
Parameters

event (QPaintEvent) –

receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
selectStop(self, index: int)

Sets the currently selected stop.

Parameters

index (int) – index of stop, where 0 corresponds to the first stop

See also

selectedStop()

selectedStop(self) QgsGradientStop

Returns details about the currently selected stop.

See also

selectStop()

Return type

QgsGradientStop

selectedStopChanged

Emitted when the current selected stop changes.

Parameters

stop (QgsGradientStop) – details about newly selected stop [signal]

sender(self) QObject
senderSignalIndex(self) int
setColor1(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color for the first stop.

Parameters

color (Union[QColor) – new stop color

See also

setColor2()

setColor2(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color for the last stop.

Parameters

color (Union[QColor) – new stop color

See also

setColor1()

setGradientRamp(self, ramp: QgsGradientColorRamp)

Sets the current ramp shown in the editor.

Parameters

ramp (QgsGradientColorRamp) – color ramp

See also

gradientRamp()

setSelectedStopColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color for the current selected stop.

Parameters

color (Union[QColor) – new stop color

See also

setColor1()

See also

setColor2()

setSelectedStopColorSpec(self, spec: QColor.Spec)

Sets the color spec for the current selected stop.

New in version 3.24.

Parameters

spec (QColor.Spec) –

setSelectedStopDetails(self, color: Union[QColor, Qt.GlobalColor, QGradient], offset: float)

Sets the color and offset for the current selected stop.

Parameters
  • color (Union[QColor) – new stop color

  • offset (float) – new stop offset

setSelectedStopDirection(self, direction: Qgis.AngularDirection)

Sets the hue angular direction for the current selected stop.

New in version 3.24.

Parameters

direction (Qgis.AngularDirection) –

setSelectedStopOffset(self, offset: float)

Sets the offset for the current selected stop. This slot has no effect if either the first or last stop is selected, as they cannot be repositioned.

Parameters

offset (float) – new stop offset

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
sizeHint(self) QSize
Return type

QSize

tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)