Class: QgsColorRampWidget

class qgis.gui.QgsColorRampWidget(parent: QWidget = None, component: QgsColorWidget.ColorComponent = QgsColorWidget.Red, orientation: QgsColorRampWidget.Orientation = QgsColorRampWidget.Horizontal)

Bases: QgsColorWidget

Construct a new color ramp widget.

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

  • component (QgsColorWidget.ColorComponent = QgsColorWidget.Red) – color component which varies along the ramp

  • orientation (QgsColorRampWidget.Orientation = QgsColorRampWidget.Horizontal) – orientation for widget

A color ramp widget. This widget consists of an interactive box filled with a color which varies along its length by a single color component (e.g., varying saturation from 0 to 100%).

Methods

actionEvent

alterColor

changeEvent

childEvent

closeEvent

componentRange

componentValue

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

hue

initPainter

inputMethodEvent

interiorMargin

Fetches the margin between the edge of the widget and the ramp

isSignalConnected

keyPressEvent

param event

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

param event

mousePressEvent

param event

mouseReleaseEvent

moveEvent

nativeEvent

orientation

Fetches the orientation for the color ramp

paintEvent

param event

receivers

resizeEvent

sender

senderSignalIndex

setInteriorMargin

Sets the margin between the edge of the widget and the ramp

setMarkerSize

Sets the size for drawing the triangular markers on the ramp

setOrientation

Sets the orientation for the color ramp

setShowFrame

Sets whether the ramp should be drawn within a frame

sharedPainter

showEvent

showFrame

Fetches whether the ramp is drawn within a frame

sizeHint

rtype

QSize

tabletEvent

timerEvent

transparentBackground

updateMicroFocus

wheelEvent

param event

Signals

valueChanged

Emitted when the widget’s color component value changes

Attributes

Horizontal

Vertical

Horizontal = 0
class Orientation

Bases: int

Vertical = 1
actionEvent()
alterColor()
changeEvent()
childEvent()
closeEvent()
componentRange()
componentValue()
connectNotify()
contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
hue()
initPainter()
inputMethodEvent()
interiorMargin(self) → int

Fetches the margin between the edge of the widget and the ramp

Return type

int

Returns

margin around the ramp

isSignalConnected()
keyPressEvent(self, event: QKeyEvent)
Parameters

event (QKeyEvent) –

keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mousePressEvent(self, event: QMouseEvent)
Parameters

event (QMouseEvent) –

mouseReleaseEvent()
moveEvent()
nativeEvent()
orientation(self) → QgsColorRampWidget.Orientation

Fetches the orientation for the color ramp

Return type

QgsColorRampWidget.Orientation

Returns

orientation for the ramp

See also

setOrientation()

paintEvent(self, event: QPaintEvent)
Parameters

event (QPaintEvent) –

receivers()
resizeEvent()
sender()
senderSignalIndex()
setInteriorMargin(self, margin: int)

Sets the margin between the edge of the widget and the ramp

Parameters

margin (int) – margin around the ramp

See also

interiorMargin()

setMarkerSize(self, markerSize: int)

Sets the size for drawing the triangular markers on the ramp

Parameters

markerSize (int) – marker size in pixels

setOrientation(self, orientation: QgsColorRampWidget.Orientation)

Sets the orientation for the color ramp

Parameters

orientation (QgsColorRampWidget.Orientation) – new orientation for the ramp

See also

orientation()

setShowFrame(self, showFrame: bool)

Sets whether the ramp should be drawn within a frame

Parameters

showFrame (bool) – set to true to draw a frame around the ramp

See also

showFrame()

sharedPainter()
showEvent()
showFrame(self) → bool

Fetches whether the ramp is drawn within a frame

Return type

bool

Returns

true if a frame is drawn around the ramp

See also

setShowFrame()

sizeHint(self) → QSize
Return type

QSize

tabletEvent()
timerEvent()
transparentBackground()
updateMicroFocus()
valueChanged

Emitted when the widget’s color component value changes

Parameters

value – new value of color component [signal]

wheelEvent(self, event: QWheelEvent)
Parameters

event (QWheelEvent) –