Class: QgsColorRampWidget

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

Bases: qgis._gui.QgsColorWidget

Construct a new color ramp widget.

Parameters
  • parent – parent QWidget for the widget

  • component – color component which varies along the ramp

  • orientation – 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%).

New in version 2.5: Enums

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

keyReleaseEvent

leaveEvent

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

orientation

Fetches the orientation for the color ramp

paintEvent

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

tabletEvent

timerEvent

transparentBackground

updateMicroFocus

wheelEvent

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

Returns

margin around the ramp

isSignalConnected()
keyPressEvent(self, event: QKeyEvent)
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent(self, event: QMouseEvent)
mousePressEvent(self, event: QMouseEvent)
mouseReleaseEvent()
moveEvent()
nativeEvent()
orientation(self) → QgsColorRampWidget.Orientation

Fetches the orientation for the color ramp

Returns

orientation for the ramp

See also

setOrientation()

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

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

Parameters

margin – margin around the ramp

See also

interiorMargin()

setMarkerSize(self, markerSize: int)

Sets the size for drawing the triangular markers on the ramp

Parameters

markerSize – marker size in pixels

setOrientation(self, orientation: QgsColorRampWidget.Orientation)

Sets the orientation for the color ramp

Parameters

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 – 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

Returns

True if a frame is drawn around the ramp

See also

setShowFrame()

sizeHint(self) → 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)