QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsvectorgradientcolorrampv2dialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsvectorgradientcolorrampv2dialog.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 QGSVECTORGRADIENTCOLORRAMPV2DIALOG_H
17 #define QGSVECTORGRADIENTCOLORRAMPV2DIALOG_H
18 
19 #include <QDialog>
20 
21 #include "ui_qgsvectorgradientcolorrampv2dialogbase.h"
22 
24 class QwtPlot;
25 class QwtPlotCurve;
26 class QwtPlotMarker;
27 class QgsGradientPlotEventFilter;
28 
32 class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, private Ui::QgsVectorGradientColorRampV2DialogBase
33 {
34  Q_OBJECT
35 
36  public:
39 
40  public slots:
41  void setColor1( const QColor& color );
42  void setColor2( const QColor& color );
43 
44  protected slots:
45  void on_cboType_currentIndexChanged( int index );
46  void on_btnInformation_pressed();
47 
48  protected:
50 
51  private slots:
52 
53  void updateRampFromStopEditor();
54  void updateColorButtons();
55  void updateStopEditor();
56  void selectedStopChanged( const QgsGradientStop& stop );
57  void colorWidgetChanged( const QColor& color );
58  void on_mPositionSpinBox_valueChanged( double val );
59  void on_mPlotHueCheckbox_toggled( bool checked );
60  void on_mPlotLightnessCheckbox_toggled( bool checked );
61  void on_mPlotSaturationCheckbox_toggled( bool checked );
62  void on_mPlotAlphaCheckbox_toggled( bool checked );
63  void plotMousePress( QPointF point );
64  void plotMouseRelease( QPointF point );
65  void plotMouseMove( QPointF point );
66 
67  private:
68 
69  QwtPlotCurve* mLightnessCurve;
70  QwtPlotCurve* mSaturationCurve;
71  QwtPlotCurve* mHueCurve;
72  QwtPlotCurve* mAlphaCurve;
73  QList< QwtPlotMarker* > mMarkers;
74  QgsGradientPlotEventFilter* mPlotFilter;
75  int mCurrentPlotColorComponent;
76  int mCurrentPlotMarkerIndex;
77 
78  void updatePlot();
79  void addPlotMarker( double x, double y, const QColor &color, bool isSelected = false );
80  void addMarkersForColor( double x, const QColor &color, bool isSelected = false );
81 };
82 
83 
84 //
85 // NOTE:
86 // For private only, not part of stable api or exposed to Python bindings
87 //
89 class GUI_EXPORT QgsGradientPlotEventFilter: public QObject
90 {
91  Q_OBJECT
92 
93  public:
94 
95  QgsGradientPlotEventFilter( QwtPlot *plot );
96 
97  virtual ~QgsGradientPlotEventFilter() {}
98 
99  virtual bool eventFilter( QObject* object, QEvent* event ) override;
100 
101  signals:
102 
103  void mousePress( QPointF );
104  void mouseRelease( QPointF );
105  void mouseMove( QPointF );
106 
107  private:
108 
109  QwtPlot* mPlot;
110  QPointF mapPoint( QPointF point ) const;
111 };
113 
114 #endif
static unsigned index
Represents a color stop within a gradient color ramp.
virtual bool eventFilter(QObject *watched, QEvent *event)
Gradient color ramp, which smoothly interpolates between two colors and also supports optional extra ...