QGIS API Documentation 4.1.0-Master (3b8ef1f72a3)
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
29class QwtPlot;
30class QwtPlotCurve;
31class QwtPlotMarker;
32class QgsGradientPlotEventFilter;
33
39class GUI_EXPORT QgsGradientColorRampDialog : public QDialog, private Ui::QgsGradientColorRampDialogBase
40{
41 Q_OBJECT
42 Q_PROPERTY( QgsGradientColorRamp ramp READ ramp WRITE setRamp )
43
44 public:
49
55 QgsGradientColorRampDialog( const QgsGradientColorRamp &ramp, QWidget *parent SIP_TRANSFERTHIS = nullptr );
57
62 QgsGradientColorRamp ramp() const { return mRamp; }
63
69 void setRamp( const QgsGradientColorRamp &ramp );
70
75 QDialogButtonBox *buttonBox() const;
76
77 signals:
78
80 void changed();
81
82 public slots:
83
88 void setColor1( const QColor &color );
89
94 void setColor2( const QColor &color );
95
96 private slots:
97 void cboType_currentIndexChanged( int index );
98 void btnInformation_pressed();
99 void updateRampFromStopEditor();
100 void updateColorButtons();
101 void updateStopEditor();
102 void selectedStopChanged( const QgsGradientStop &stop );
103 void colorWidgetChanged( const QColor &color );
104 void mPositionSpinBox_valueChanged( double val );
105 void mPlotHueCheckbox_toggled( bool checked );
106 void mPlotLightnessCheckbox_toggled( bool checked );
107 void mPlotSaturationCheckbox_toggled( bool checked );
108 void mPlotAlphaCheckbox_toggled( bool checked );
109 void plotMousePress( QPointF point );
110 void plotMouseRelease( QPointF point );
111 void plotMouseMove( QPointF point );
112 void showHelp();
113
114 private:
116 QwtPlotCurve *mLightnessCurve = nullptr;
117 QwtPlotCurve *mSaturationCurve = nullptr;
118 QwtPlotCurve *mHueCurve = nullptr;
119 QwtPlotCurve *mAlphaCurve = nullptr;
120 QList<QwtPlotMarker *> mMarkers;
121 QgsGradientPlotEventFilter *mPlotFilter = nullptr;
122 int mCurrentPlotColorComponent = -1;
123 int mCurrentPlotMarkerIndex = 0;
124 int mBlockChanges = 0;
125
126 void updatePlot();
127 void addPlotMarker( double x, double y, const QColor &color, bool isSelected = false );
128 void addMarkersForColor( double x, const QColor &color, bool isSelected = false );
129
130 // Returns TRUE if it's possible to edit direction regarding given colorSpec
131 static bool hasDirection( QColor::Spec colorSpec );
132};
133
134
135#ifndef SIP_RUN
136//
137// NOTE:
138// For private only, not part of stable api or exposed to Python bindings
139//
141class GUI_EXPORT QgsGradientPlotEventFilter : public QObject
142{
143 Q_OBJECT
144
145 public:
146 QgsGradientPlotEventFilter( QwtPlot *plot );
147
148 bool eventFilter( QObject *object, QEvent *event ) override;
149
150 signals:
151
152 void mousePress( QPointF );
153 void mouseRelease( QPointF );
154 void mouseMove( QPointF );
155
156 private:
157 QwtPlot *mPlot = nullptr;
158 QPointF mapPoint( QPointF point ) const;
159};
161#endif
162
163#endif
static const QgsSettingsEntryBool * settingsPlotSaturation
void setColor2(const QColor &color)
Sets the end color for the gradient ramp.
static const QgsSettingsEntryBool * settingsPlotHue
static const QgsSettingsEntryBool * settingsPlotAlpha
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.
static const QgsSettingsEntryBool * settingsPlotLightness
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...
Represents a color stop within a QgsGradientColorRamp color ramp.
A boolean settings entry.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_SKIP
Definition qgis_sip.h:133