QGIS API Documentation  2.15.0-Master (5773d0d)
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 
29 class GUI_EXPORT QgsVectorGradientColorRampV2Dialog : public QDialog, private Ui::QgsVectorGradientColorRampV2DialogBase
30 {
31  Q_OBJECT
32 
33  public:
36 
37  public slots:
38  void setColor1( const QColor& color );
39  void setColor2( const QColor& color );
40 
41  protected slots:
42  void on_cboType_currentIndexChanged( int index );
43  void on_btnInformation_pressed();
44 
45  protected:
47 
48  private slots:
49 
50  void updateRampFromStopEditor();
51  void updateColorButtons();
52  void updateStopEditor();
53  void selectedStopChanged( const QgsGradientStop& stop );
54  void colorWidgetChanged( const QColor& color );
55  void on_mPositionSpinBox_valueChanged( double val );
56  void on_mPlotHueCheckbox_toggled( bool checked );
57  void on_mPlotLightnessCheckbox_toggled( bool checked );
58  void on_mPlotSaturationCheckbox_toggled( bool checked );
59  void on_mPlotAlphaCheckbox_toggled( bool checked );
60  void plotMousePress( QPointF point );
61  void plotMouseRelease( QPointF point );
62  void plotMouseMove( QPointF point );
63 
64  private:
65 
66  QwtPlotCurve* mLightnessCurve;
67  QwtPlotCurve* mSaturationCurve;
68  QwtPlotCurve* mHueCurve;
69  QwtPlotCurve* mAlphaCurve;
70  QList< QwtPlotMarker* > mMarkers;
71  QgsGradientPlotEventFilter* mPlotFilter;
72  int mCurrentPlotColorComponent;
73  int mCurrentPlotMarkerIndex;
74 
75  void updatePlot();
76  void addPlotMarker( double x, double y, const QColor &color, bool isSelected = false );
77  void addMarkersForColor( double x, const QColor &color, bool isSelected = false );
78 };
79 
80 
81 //
82 // NOTE:
83 // For private only, not part of stable api or exposed to Python bindings
84 //
86 class GUI_EXPORT QgsGradientPlotEventFilter: public QObject
87 {
88  Q_OBJECT
89 
90  public:
91 
92  QgsGradientPlotEventFilter( QwtPlot *plot );
93 
94  virtual ~QgsGradientPlotEventFilter() {}
95 
96  virtual bool eventFilter( QObject* object, QEvent* event ) override;
97 
98  signals:
99 
100  void mousePress( QPointF );
101  void mouseRelease( QPointF );
102  void mouseMove( QPointF );
103 
104  private:
105 
106  QwtPlot* mPlot;
107  QPointF mapPoint( QPointF point ) const;
108 };
110 
111 #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 ...