Class: QgsGradientStopEditor

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

Class Hierarchy

Inheritance diagram of qgis.gui.QgsGradientStopEditor

Base classes

QWidget

QObject

QPaintDevice

class qgis.gui.QgsGradientStopEditor[source]

Bases: QWidget

__init__(parent: QWidget | None = None, ramp: QgsGradientColorRamp | None = None)

Constructor for QgsGradientStopEditor.

Parameters:
  • parent (Optional[QWidget] = None) – parent widget

  • ramp (Optional[QgsGradientColorRamp] = None) – optional initial gradient ramp

signal changed[source]

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.

deleteSelectedStop(self)[source]

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

gradientRamp(self) QgsGradientColorRamp[source]

Returns the current ramp created by the editor.

Return type:

QgsGradientColorRamp

selectStop(self, index: int)[source]

Sets the currently selected stop.

Parameters:

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

See also

selectedStop()

selectedStop(self) QgsGradientStop[source]

Returns details about the currently selected stop.

See also

selectStop()

Return type:

QgsGradientStop

signal selectedStopChanged[source]

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.

setColor1(self, color: QColor | Qt.GlobalColor)[source]

Sets the color for the first stop.

Parameters:

color (Union[QColor, Qt.GlobalColor]) – new stop color

See also

setColor2()

setColor2(self, color: QColor | Qt.GlobalColor)[source]

Sets the color for the last stop.

Parameters:

color (Union[QColor, Qt.GlobalColor]) – new stop color

See also

setColor1()

setGradientRamp(self, ramp: QgsGradientColorRamp)[source]

Sets the current ramp shown in the editor.

Parameters:

ramp (QgsGradientColorRamp) – color ramp

See also

gradientRamp()

setSelectedStopColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the color for the current selected stop.

Parameters:

color (Union[QColor, Qt.GlobalColor]) – new stop color

See also

setColor1()

See also

setColor2()

setSelectedStopColorSpec(self, spec: QColor.Spec)[source]

Sets the color spec for the current selected stop.

Added in version 3.24.

Parameters:

spec (QColor.Spec)

setSelectedStopDetails(self, color: QColor | Qt.GlobalColor, offset: float)[source]

Sets the color and offset for the current selected stop.

Parameters:
  • color (Union[QColor, Qt.GlobalColor]) – new stop color

  • offset (float) – new stop offset

setSelectedStopDirection(self, direction: Qgis.AngularDirection)[source]

Sets the hue angular direction for the current selected stop.

Added in version 3.24.

Parameters:

direction (Qgis.AngularDirection)

setSelectedStopOffset(self, offset: float)[source]

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