Class: QgsColorRampWidget¶
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%).
Class Hierarchy¶
Base classes¶
A base class for interactive color widgets. |
|
Methods
Fetches the margin between the edge of the widget and the ramp |
|
Fetches the orientation for the color ramp |
|
Sets the margin between the edge of the widget and the ramp |
|
Sets the size for drawing the triangular markers on the ramp |
|
Sets the orientation for the color ramp |
|
Sets whether the ramp should be drawn within a frame |
|
Fetches whether the ramp is drawn within a frame |
Signals
Emitted when the widget's color component value changes |
|
Emitted when the widget's color component value changes |
Attributes
- class qgis.gui.QgsColorRampWidget[source]¶
Bases:
QgsColorWidget
- __init__(parent: QWidget | None = None, component: QgsColorWidget.ColorComponent = QgsColorWidget.Red, orientation: QgsColorRampWidget.Orientation = QgsColorRampWidget.Horizontal)
Construct a new color ramp widget.
- Parameters:
parent (Optional[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
- Horizontal = 0¶
- class Orientation¶
Bases:
int
- Vertical = 1¶
- interiorMargin(self) int [source]¶
Fetches the margin between the edge of the widget and the ramp
- Return type:
int
- Returns:
margin around the ramp
See also
- orientation(self) QgsColorRampWidget.Orientation [source]¶
Fetches the orientation for the color ramp
- Return type:
- Returns:
orientation for the ramp
See also
- setInteriorMargin(self, margin: int)[source]¶
Sets the margin between the edge of the widget and the ramp
- Parameters:
margin (int) – margin around the ramp
See also
- setMarkerSize(self, markerSize: int)[source]¶
Sets the size for drawing the triangular markers on the ramp
- Parameters:
markerSize (int) – marker size in pixels
- setOrientation(self, orientation: QgsColorRampWidget.Orientation)[source]¶
Sets the orientation for the color ramp
- Parameters:
orientation (QgsColorRampWidget.Orientation) – new orientation for the ramp
See also
- setShowFrame(self, showFrame: bool)[source]¶
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(self) bool [source]¶
Fetches whether the ramp is drawn within a frame
- Return type:
bool
- Returns:
True
if a frame is drawn around the ramp
See also
- signal valueChanged[source]¶
Emitted when the widget’s color component value changes
- Parameters:
value – new value of color component in the range between 0 and the value returned by
componentRange()
Deprecated since version 3.40: Use
valueChangedF()
instead.