QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsgradientcolorrampdialog.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgradientcolorrampdialog.h
3 ----------------------------
4 begin : December 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSGRADIENTCOLORRAMPDIALOG_H
17#define QGSGRADIENTCOLORRAMPDIALOG_H
18
19#include <QDialog>
20#include "qgis_sip.h"
21
22#include "ui_qgsgradientcolorrampdialogbase.h"
23#include "qgshelp.h"
24#include "qgis_gui.h"
25
27class QwtPlot;
28class QwtPlotCurve;
29class QwtPlotMarker;
30class QgsGradientPlotEventFilter;
31
37class GUI_EXPORT QgsGradientColorRampDialog : public QDialog, private Ui::QgsGradientColorRampDialogBase
38{
39 Q_OBJECT
40 Q_PROPERTY( QgsGradientColorRamp ramp READ ramp WRITE setRamp )
41
42 public:
43
49 QgsGradientColorRampDialog( const QgsGradientColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
51
56 QgsGradientColorRamp ramp() const { return mRamp; }
57
63 void setRamp( const QgsGradientColorRamp &ramp );
64
69 QDialogButtonBox *buttonBox() const;
70
71 signals:
72
74 void changed();
75
76 public slots:
77
82 void setColor1( const QColor &color );
83
88 void setColor2( const QColor &color );
89
90 private slots:
91 void cboType_currentIndexChanged( int index );
92 void btnInformation_pressed();
93 void updateRampFromStopEditor();
94 void updateColorButtons();
95 void updateStopEditor();
96 void selectedStopChanged( const QgsGradientStop &stop );
97 void colorWidgetChanged( const QColor &color );
98 void mPositionSpinBox_valueChanged( double val );
99 void mPlotHueCheckbox_toggled( bool checked );
100 void mPlotLightnessCheckbox_toggled( bool checked );
101 void mPlotSaturationCheckbox_toggled( bool checked );
102 void mPlotAlphaCheckbox_toggled( bool checked );
103 void plotMousePress( QPointF point );
104 void plotMouseRelease( QPointF point );
105 void plotMouseMove( QPointF point );
106 void showHelp();
107
108 private:
109
111 QwtPlotCurve *mLightnessCurve = nullptr;
112 QwtPlotCurve *mSaturationCurve = nullptr;
113 QwtPlotCurve *mHueCurve = nullptr;
114 QwtPlotCurve *mAlphaCurve = nullptr;
115 QList< QwtPlotMarker * > mMarkers;
116 QgsGradientPlotEventFilter *mPlotFilter = nullptr;
117 int mCurrentPlotColorComponent;
118 int mCurrentPlotMarkerIndex;
119 int mBlockChanges = 0;
120
121 void updatePlot();
122 void addPlotMarker( double x, double y, const QColor &color, bool isSelected = false );
123 void addMarkersForColor( double x, const QColor &color, bool isSelected = false );
124
125 // Returns TRUE if it's possible to edit direction regarding given colorSpec
126 static bool hasDirection( QColor::Spec colorSpec );
127};
128
129
130#ifndef SIP_RUN
131//
132// NOTE:
133// For private only, not part of stable api or exposed to Python bindings
134//
136class GUI_EXPORT QgsGradientPlotEventFilter: public QObject
137{
138 Q_OBJECT
139
140 public:
141
142 QgsGradientPlotEventFilter( QwtPlot *plot );
143
144 bool eventFilter( QObject *object, QEvent *event ) override;
145
146 signals:
147
148 void mousePress( QPointF );
149 void mouseRelease( QPointF );
150 void mouseMove( QPointF );
151
152 private:
153
154 QwtPlot *mPlot = nullptr;
155 QPointF mapPoint( QPointF point ) const;
156};
158#endif
159
160#endif
A dialog which allows users to modify the properties of a QgsGradientColorRamp.
QgsGradientColorRamp ramp() const
Returns a color ramp representing the current settings from the dialog.
void changed()
Emitted when the dialog settings change.
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
Represents a color stop within a QgsGradientColorRamp color ramp.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53