QGIS API Documentation 3.41.0-Master (57ec4277f5e)
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:
48 QgsGradientColorRampDialog( const QgsGradientColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
50
55 QgsGradientColorRamp ramp() const { return mRamp; }
56
62 void setRamp( const QgsGradientColorRamp &ramp );
63
68 QDialogButtonBox *buttonBox() const;
69
70 signals:
71
73 void changed();
74
75 public slots:
76
81 void setColor1( const QColor &color );
82
87 void setColor2( const QColor &color );
88
89 private slots:
90 void cboType_currentIndexChanged( int index );
91 void btnInformation_pressed();
92 void updateRampFromStopEditor();
93 void updateColorButtons();
94 void updateStopEditor();
95 void selectedStopChanged( const QgsGradientStop &stop );
96 void colorWidgetChanged( const QColor &color );
97 void mPositionSpinBox_valueChanged( double val );
98 void mPlotHueCheckbox_toggled( bool checked );
99 void mPlotLightnessCheckbox_toggled( bool checked );
100 void mPlotSaturationCheckbox_toggled( bool checked );
101 void mPlotAlphaCheckbox_toggled( bool checked );
102 void plotMousePress( QPointF point );
103 void plotMouseRelease( QPointF point );
104 void plotMouseMove( QPointF point );
105 void showHelp();
106
107 private:
109 QwtPlotCurve *mLightnessCurve = nullptr;
110 QwtPlotCurve *mSaturationCurve = nullptr;
111 QwtPlotCurve *mHueCurve = nullptr;
112 QwtPlotCurve *mAlphaCurve = nullptr;
113 QList<QwtPlotMarker *> mMarkers;
114 QgsGradientPlotEventFilter *mPlotFilter = nullptr;
115 int mCurrentPlotColorComponent;
116 int mCurrentPlotMarkerIndex;
117 int mBlockChanges = 0;
118
119 void updatePlot();
120 void addPlotMarker( double x, double y, const QColor &color, bool isSelected = false );
121 void addMarkersForColor( double x, const QColor &color, bool isSelected = false );
122
123 // Returns TRUE if it's possible to edit direction regarding given colorSpec
124 static bool hasDirection( QColor::Spec colorSpec );
125};
126
127
128#ifndef SIP_RUN
129//
130// NOTE:
131// For private only, not part of stable api or exposed to Python bindings
132//
134class GUI_EXPORT QgsGradientPlotEventFilter : public QObject
135{
136 Q_OBJECT
137
138 public:
139 QgsGradientPlotEventFilter( QwtPlot *plot );
140
141 bool eventFilter( QObject *object, QEvent *event ) override;
142
143 signals:
144
145 void mousePress( QPointF );
146 void mouseRelease( QPointF );
147 void mouseMove( QPointF );
148
149 private:
150 QwtPlot *mPlot = nullptr;
151 QPointF mapPoint( QPointF point ) const;
152};
154#endif
155
156#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