Subgroup: Gradient

Class: QgsGradientStopEditor

class qgis.gui.QgsGradientStopEditor(parent: QWidget = None, ramp: QgsGradientColorRamp = None)

Bases: PyQt5.QtWidgets.QWidget

Constructor for QgsGradientStopEditor.

Parameters:
  • parent – parent widget
  • ramp – optional initial gradient ramp

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

New in version 2.16: Methods

actionEvent
changeEvent
childEvent
closeEvent
connectNotify
contextMenuEvent
create
customEvent
deleteSelectedStop Deletes the current selected stop.
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
enterEvent
event
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
gradientRamp Returns the current ramp created by the editor.
hideEvent
initPainter
inputMethodEvent
isSignalConnected
keyPressEvent
keyReleaseEvent
leaveEvent
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
paintEvent
receivers
resizeEvent
selectStop Sets the currently selected stop.
selectedStop Returns details about the currently selected stop.
sender
senderSignalIndex
setColor1 Sets the color for the first stop.
setColor2 Sets the color for the last stop.
setGradientRamp Sets the current ramp shown in the editor.
setSelectedStopColor Sets the color for the current selected stop.
setSelectedStopDetails Sets the color and offset for the current selected stop.
setSelectedStopOffset Sets the offset for the current selected stop.
sharedPainter
showEvent
sizeHint
tabletEvent
timerEvent
updateMicroFocus
wheelEvent

Signals

changed Emitted when the gradient ramp is changed by a user [signal]
selectedStopChanged Emitted when the current selected stop changes.

Attributes

actionEvent()
changeEvent()
changed

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

childEvent()
closeEvent()
connectNotify()
contextMenuEvent()
create()
customEvent()
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()
disconnectNotify()
dragEnterEvent(self, e: QDragEnterEvent)
dragLeaveEvent()
dragMoveEvent()
dropEvent(self, e: QDropEvent)
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
gradientRamp(self) → QgsGradientColorRamp

Returns the current ramp created by the editor.

hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent(self, event: QKeyEvent)
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent(self, event: QMouseEvent)
mouseMoveEvent(self, event: QMouseEvent)
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent(self, event: QPaintEvent)
receivers()
resizeEvent()
selectStop(self, index: int)

Sets the currently selected stop.

Parameters:index – 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()

selectedStopChanged

Emitted when the current selected stop changes.

Parameters:stop – details about newly selected stop [signal]
sender()
senderSignalIndex()
setColor1(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color for the first stop.

Parameters:color – new stop color

See also

setColor2()

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

Sets the color for the last stop.

Parameters:color – new stop color

See also

setColor1()

setGradientRamp(self, ramp: QgsGradientColorRamp)

Sets the current ramp shown in the editor.

Parameters:ramp – color ramp

See also

gradientRamp()

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

Sets the color for the current selected stop.

Parameters:color – new stop color

See also

setColor1()

See also

setColor2()

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

Sets the color and offset for the current selected stop.

Parameters:
  • color – new stop color
  • offset – new stop offset
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 – new stop offset
sharedPainter()
showEvent()
sizeHint(self) → QSize
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()