QGIS API Documentation  2.99.0-Master (7d4f81d)
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsGradientStopEditor Class Reference

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

#include <qgsgradientstopeditor.h>

Inheritance diagram for QgsGradientStopEditor:
Inheritance graph
[legend]

Public Slots

void deleteSelectedStop ()
 Deletes the current selected stop. More...
 
void setColor1 (const QColor &color)
 Sets the color for the first stop. More...
 
void setColor2 (const QColor &color)
 Sets the color for the last stop. More...
 
void setSelectedStopColor (const QColor &color)
 Sets the color for the current selected stop. More...
 
void setSelectedStopDetails (const QColor &color, double offset)
 Sets the color and offset for the current selected stop. More...
 
void setSelectedStopOffset (double offset)
 Sets the offset for the current selected stop. More...
 

Signals

void changed ()
 Emitted when the gradient ramp is changed by a user. More...
 
void selectedStopChanged (const QgsGradientStop &stop)
 Emitted when the current selected stop changes. More...
 

Public Member Functions

 QgsGradientStopEditor (QWidget *parent=0, QgsGradientColorRamp *ramp=nullptr)
 Constructor for QgsGradientStopEditor. More...
 
QgsGradientColorRamp gradientRamp () const
 Returns the current ramp created by the editor. More...
 
void paintEvent (QPaintEvent *event) override
 
QgsGradientStop selectedStop () const
 Returns details about the currently selected stop. More...
 
void selectStop (int index)
 Sets the currently selected stop. More...
 
void setGradientRamp (const QgsGradientColorRamp &ramp)
 Sets the current ramp shown in the editor. More...
 
virtual QSize sizeHint () const override
 

Protected Member Functions

void dragEnterEvent (QDragEnterEvent *e) override
 
void dropEvent (QDropEvent *e) override
 
virtual void keyPressEvent (QKeyEvent *event) override
 
virtual void mouseDoubleClickEvent (QMouseEvent *event) override
 
virtual void mouseMoveEvent (QMouseEvent *event) override
 
virtual void mousePressEvent (QMouseEvent *event) override
 

Detailed Description

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

Since
QGIS 2.16

Definition at line 32 of file qgsgradientstopeditor.h.

Constructor & Destructor Documentation

◆ QgsGradientStopEditor()

QgsGradientStopEditor::QgsGradientStopEditor ( QWidget *  parent = 0,
QgsGradientColorRamp ramp = nullptr 
)

Constructor for QgsGradientStopEditor.

Parameters
parentparent widget
rampoptional initial gradient ramp

Definition at line 32 of file qgsgradientstopeditor.cpp.

Member Function Documentation

◆ changed

void QgsGradientStopEditor::changed ( )
signal

Emitted when the gradient ramp is changed by a user.

◆ deleteSelectedStop

void QgsGradientStopEditor::deleteSelectedStop ( )
slot

Deletes the current selected stop.

This slot has no effect if either the first or last stop is selected, as they cannot be deleted.

Definition at line 225 of file qgsgradientstopeditor.cpp.

◆ dragEnterEvent()

void QgsGradientStopEditor::dragEnterEvent ( QDragEnterEvent *  e)
overrideprotected

Definition at line 442 of file qgsgradientstopeditor.cpp.

◆ dropEvent()

void QgsGradientStopEditor::dropEvent ( QDropEvent *  e)
overrideprotected

Definition at line 455 of file qgsgradientstopeditor.cpp.

◆ gradientRamp()

QgsGradientColorRamp QgsGradientStopEditor::gradientRamp ( ) const
inline

Returns the current ramp created by the editor.

See also
setGradientRamp()

Definition at line 53 of file qgsgradientstopeditor.h.

◆ keyPressEvent()

void QgsGradientStopEditor::keyPressEvent ( QKeyEvent *  event)
overrideprotectedvirtual

Definition at line 345 of file qgsgradientstopeditor.cpp.

◆ mouseDoubleClickEvent()

void QgsGradientStopEditor::mouseDoubleClickEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Definition at line 330 of file qgsgradientstopeditor.cpp.

◆ mouseMoveEvent()

void QgsGradientStopEditor::mouseMoveEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Definition at line 256 of file qgsgradientstopeditor.cpp.

◆ mousePressEvent()

void QgsGradientStopEditor::mousePressEvent ( QMouseEvent *  event)
overrideprotectedvirtual

Definition at line 315 of file qgsgradientstopeditor.cpp.

◆ paintEvent()

void QgsGradientStopEditor::paintEvent ( QPaintEvent *  event)
override

Definition at line 76 of file qgsgradientstopeditor.cpp.

◆ selectedStop()

QgsGradientStop QgsGradientStopEditor::selectedStop ( ) const

Returns details about the currently selected stop.

See also
selectStop()

Definition at line 158 of file qgsgradientstopeditor.cpp.

◆ selectedStopChanged

void QgsGradientStopEditor::selectedStopChanged ( const QgsGradientStop stop)
signal

Emitted when the current selected stop changes.

Parameters
stopdetails about newly selected stop

◆ selectStop()

void QgsGradientStopEditor::selectStop ( int  index)

Sets the currently selected stop.

Parameters
indexindex of stop, where 0 corresponds to the first stop
See also
selectedStop()

Definition at line 136 of file qgsgradientstopeditor.cpp.

◆ setColor1

void QgsGradientStopEditor::setColor1 ( const QColor &  color)
slot

Sets the color for the first stop.

Parameters
colornew stop color
See also
setColor2()
setSelectedStopColor()

Definition at line 242 of file qgsgradientstopeditor.cpp.

◆ setColor2

void QgsGradientStopEditor::setColor2 ( const QColor &  color)
slot

Sets the color for the last stop.

Parameters
colornew stop color
See also
setColor1()
setSelectedStopColor()

Definition at line 249 of file qgsgradientstopeditor.cpp.

◆ setGradientRamp()

void QgsGradientStopEditor::setGradientRamp ( const QgsGradientColorRamp ramp)

Sets the current ramp shown in the editor.

Parameters
rampcolor ramp
See also
gradientRamp()

Definition at line 61 of file qgsgradientstopeditor.cpp.

◆ setSelectedStopColor

void QgsGradientStopEditor::setSelectedStopColor ( const QColor &  color)
slot

Sets the color for the current selected stop.

Parameters
colornew stop color
See also
setSelectedStopOffset()
setSelectedStopDetails()
setColor1()
setColor2()

Definition at line 174 of file qgsgradientstopeditor.cpp.

◆ setSelectedStopDetails

void QgsGradientStopEditor::setSelectedStopDetails ( const QColor &  color,
double  offset 
)
slot

Sets the color and offset for the current selected stop.

Parameters
colornew stop color
offsetnew stop offset
See also
setSelectedStopColor()
setSelectedStopOffset()

Definition at line 204 of file qgsgradientstopeditor.cpp.

◆ setSelectedStopOffset

void QgsGradientStopEditor::setSelectedStopOffset ( double  offset)
slot

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
offsetnew stop offset
See also
setSelectedStopColor()
setSelectedStopDetails()

Definition at line 193 of file qgsgradientstopeditor.cpp.

◆ sizeHint()

QSize QgsGradientStopEditor::sizeHint ( ) const
overridevirtual

Definition at line 70 of file qgsgradientstopeditor.cpp.


The documentation for this class was generated from the following files: