Subgroup: Color

Class: QgsColorRampWidget

class qgis.gui.QgsColorRampWidget

Bases: qgis._gui.QgsColorWidget

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: Methods

acceptDrops
accessibleDescription
accessibleName
actionEvent
actions
activateWindow
addAction
addActions
adjustSize
alterColor
autoFillBackground
backgroundRole
baseSize
blockSignals
changeEvent
childAt childAt(self, int, int) -> QWidget
childEvent
children
childrenRect
childrenRegion
clearFocus
clearMask
close
closeEvent
color Returns the current color for the widget
colorCount
component Returns the color component which the widget controls
componentRange
componentValue
connectNotify
contentsMargins
contentsRect
contextMenuEvent
contextMenuPolicy
create
createDragIcon Create an icon for dragging colors
createWindowContainer
cursor
customEvent
deleteLater
depth
destroy
devType
devicePixelRatio
devicePixelRatioF
devicePixelRatioFScale
disconnect
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
effectiveWinId
ensurePolished
enterEvent
event
eventFilter
find
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPolicy
focusPreviousChild
focusProxy
focusWidget
font
fontInfo
fontMetrics
foregroundRole
frameGeometry
frameSize
geometry
getContentsMargins
grab
grabGesture
grabKeyboard
grabMouse grabMouse(self, Union[QCursor, Qt.CursorShape])
grabShortcut
graphicsEffect
graphicsProxyWidget
hasFocus
hasHeightForWidth
hasMouseTracking
hasTabletTracking
height
heightForWidth
heightMM
hide
hideEvent
hue
inherits
initPainter
inputMethodEvent
inputMethodHints
inputMethodQuery
insertAction
insertActions
installEventFilter
interiorMargin Fetches the margin between the edge of the widget and the ramp
isActiveWindow
isAncestorOf
isEnabled
isEnabledTo
isFullScreen
isHidden
isLeftToRight
isMaximized
isMinimized
isModal
isRightToLeft
isSignalConnected
isVisible
isVisibleTo
isWidgetType
isWindow
isWindowModified
isWindowType
keyPressEvent
keyReleaseEvent
keyboardGrabber
killTimer
layout
layoutDirection
leaveEvent
locale
logicalDpiX
logicalDpiY
lower
mapFrom
mapFromGlobal
mapFromParent
mapTo
mapToGlobal
mapToParent
mask
maximumHeight
maximumSize
maximumWidth
metaObject
metric
minimumHeight
minimumSize
minimumSizeHint
minimumWidth
mouseDoubleClickEvent
mouseGrabber
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
move move(self, int, int)
moveEvent
moveToThread
nativeEvent
nativeParentWidget
nextInFocusChain
normalGeometry
objectName
orientation Fetches the orientation for the color ramp
overrideWindowFlags
overrideWindowState
paintEngine
paintEvent
paintingActive
palette
parent
parentWidget
physicalDpiX
physicalDpiY
pos
previousInFocusChain
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
raise_
receivers
rect
releaseKeyboard
releaseMouse
releaseShortcut
removeAction
removeEventFilter
render render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))
repaint repaint(self, int, int, int, int)
resize resize(self, int, int)
resizeEvent
restoreGeometry
saveGeometry
scroll scroll(self, int, int, QRect)
sender
senderSignalIndex
setAcceptDrops
setAccessibleDescription
setAccessibleName
setAttribute
setAutoFillBackground
setBackgroundRole
setBaseSize setBaseSize(self, QSize)
setColor Sets the color for the widget
setComponent Sets the color component which the widget controls
setComponentValue Alters the widget’s color by setting the value for the widget’s color component
setContentsMargins setContentsMargins(self, QMargins)
setContextMenuPolicy
setCursor
setDisabled
setEnabled
setFixedHeight
setFixedSize setFixedSize(self, int, int)
setFixedWidth
setFocus setFocus(self, Qt.FocusReason)
setFocusPolicy
setFocusProxy
setFont
setForegroundRole
setGeometry setGeometry(self, int, int, int, int)
setGraphicsEffect
setHidden
setInputMethodHints
setInteriorMargin Sets the margin between the edge of the widget and the ramp
setLayout
setLayoutDirection
setLocale
setMarkerSize Sets the size for drawing the triangular markers on the ramp
setMask setMask(self, QRegion)
setMaximumHeight
setMaximumSize setMaximumSize(self, QSize)
setMaximumWidth
setMinimumHeight
setMinimumSize setMinimumSize(self, QSize)
setMinimumWidth
setMouseTracking
setObjectName
setOrientation Sets the orientation for the color ramp
setPalette
setParent setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])
setProperty
setShortcutAutoRepeat
setShortcutEnabled
setShowFrame Sets whether the ramp should be drawn within a frame
setSizeIncrement setSizeIncrement(self, QSize)
setSizePolicy setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)
setStatusTip
setStyle
setStyleSheet
setTabOrder
setTabletTracking
setToolTip
setToolTipDuration
setUpdatesEnabled
setVisible
setWhatsThis
setWindowFilePath
setWindowFlag
setWindowFlags
setWindowIcon
setWindowIconText
setWindowModality
setWindowModified
setWindowOpacity
setWindowRole
setWindowState
setWindowTitle
sharedPainter
show
showEvent
showFrame Fetches whether the ramp is drawn within a frame
showFullScreen
showMaximized
showMinimized
showNormal
signalsBlocked
size
sizeHint
sizeIncrement
sizePolicy
stackUnder
startTimer
statusTip
style
styleSheet
tabletEvent
testAttribute
thread
timerEvent
toolTip
toolTipDuration
tr
transparentBackground
underMouse
ungrabGesture
unsetCursor
unsetLayoutDirection
unsetLocale
update update(self, QRect)
updateGeometry
updateMicroFocus
updatesEnabled
visibleRegion
whatsThis
wheelEvent
width
widthMM
winId
window
windowFilePath
windowFlags
windowHandle
windowIcon
windowIconText
windowModality
windowOpacity
windowRole
windowState
windowTitle
windowType
x
y

Attributes

Alpha
Blue
DrawChildren
DrawWindowBackground
Green
Horizontal
Hue
IgnoreMask
Multiple
PdmDepth
PdmDevicePixelRatio
PdmDevicePixelRatioScaled
PdmDpiX
PdmDpiY
PdmHeight
PdmHeightMM
PdmNumColors
PdmPhysicalDpiX
PdmPhysicalDpiY
PdmWidth
PdmWidthMM
Red
Saturation
Value
Vertical
colorChanged Emitted when the widget’s color changes
customContextMenuRequested customContextMenuRequested(self, QPoint) [signal]
destroyed destroyed(self, QObject = None) [signal]
hovered Emitted when mouse hovers over widget.
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
valueChanged Emitted when the widget’s color component value changes
windowIconChanged windowIconChanged(self, QIcon) [signal]
windowIconTextChanged windowIconTextChanged(self, str) [signal]
windowTitleChanged windowTitleChanged(self, str) [signal]
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)