QGIS API Documentation 3.99.0-Master (2fe06baccd8)
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 "ui_qgsgradientcolorrampdialogbase.h"
20
21#include "qgis_gui.h"
22#include "qgis_sip.h"
23#include "qgshelp.h"
24
25#include <QDialog>
26
28class QwtPlot;
29class QwtPlotCurve;
30class QwtPlotMarker;
31class QgsGradientPlotEventFilter;
32
38class GUI_EXPORT QgsGradientColorRampDialog : public QDialog, private Ui::QgsGradientColorRampDialogBase
39{
40 Q_OBJECT
41 Q_PROPERTY( QgsGradientColorRamp ramp READ ramp WRITE setRamp )
42
43 public:
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:
110 QwtPlotCurve *mLightnessCurve = nullptr;
111 QwtPlotCurve *mSaturationCurve = nullptr;
112 QwtPlotCurve *mHueCurve = nullptr;
113 QwtPlotCurve *mAlphaCurve = nullptr;
114 QList<QwtPlotMarker *> mMarkers;
115 QgsGradientPlotEventFilter *mPlotFilter = nullptr;
116 int mCurrentPlotColorComponent = -1;
117 int mCurrentPlotMarkerIndex = 0;
118 int mBlockChanges = 0;
119
120 void updatePlot();
121 void addPlotMarker( double x, double y, const QColor &color, bool isSelected = false );
122 void addMarkersForColor( double x, const QColor &color, bool isSelected = false );
123
124 // Returns TRUE if it's possible to edit direction regarding given colorSpec
125 static bool hasDirection( QColor::Spec colorSpec );
126};
127
128
129#ifndef SIP_RUN
130//
131// NOTE:
132// For private only, not part of stable api or exposed to Python bindings
133//
135class GUI_EXPORT QgsGradientPlotEventFilter : public QObject
136{
137 Q_OBJECT
138
139 public:
140 QgsGradientPlotEventFilter( QwtPlot *plot );
141
142 bool eventFilter( QObject *object, QEvent *event ) override;
143
144 signals:
145
146 void mousePress( QPointF );
147 void mouseRelease( QPointF );
148 void mouseMove( QPointF );
149
150 private:
151 QwtPlot *mPlot = nullptr;
152 QPointF mapPoint( QPointF point ) const;
153};
155#endif
156
157#endif
void setColor2(const QColor &color)
Sets the end color for the gradient ramp.
void setRamp(const QgsGradientColorRamp &ramp)
Sets the color ramp to show in the dialog.
QgsGradientColorRampDialog(const QgsGradientColorRamp &ramp, QWidget *parent=nullptr)
Constructor for QgsGradientColorRampDialog.
void setColor1(const QColor &color)
Sets the start color for the gradient ramp.
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