QGIS API Documentation  2.14.0-Essen
qgspainteffectwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgspainteffectwidget.h
3  ----------------------
4  begin : January 2015
5  copyright : (C) 2015 by Nyall Dawson
6  email : nyall dot dawson at gmail.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 QGSPAINTEFFECTWIDGET_H
17 #define QGSPAINTEFFECTWIDGET_H
18 
19 #include <QWidget>
20 
21 class QgsPaintEffect;
22 class QgsShadowEffect;
24 class QgsBlurEffect;
25 class QgsGlowEffect;
26 class QgsTransformEffect;
27 class QgsColorEffect;
28 
29 
37 class GUI_EXPORT QgsPaintEffectWidget : public QWidget
38 {
39  Q_OBJECT
40 
41  public:
42  QgsPaintEffectWidget( QWidget* parent = nullptr ) : QWidget( parent ) {}
43  virtual ~QgsPaintEffectWidget() {}
44 
49  virtual void setPaintEffect( QgsPaintEffect* effect ) = 0;
50 
51  signals:
52 
56  void changed();
57 
58 };
59 
60 //individual effect widgets
61 
62 #include "ui_widget_drawsource.h"
63 
64 class GUI_EXPORT QgsDrawSourceWidget : public QgsPaintEffectWidget, private Ui::WidgetDrawSource
65 {
66  Q_OBJECT
67 
68  public:
69  QgsDrawSourceWidget( QWidget* parent = nullptr );
70 
71  static QgsPaintEffectWidget* create() { return new QgsDrawSourceWidget(); }
72 
73  virtual void setPaintEffect( QgsPaintEffect* effect ) override;
74 
75  private:
76  QgsDrawSourceEffect* mEffect;
77 
78  void initGui();
79  void blockSignals( const bool block );
80 
81  private slots:
82 
83  void on_mTransparencySpnBx_valueChanged( double value );
84  void on_mDrawModeComboBox_currentIndexChanged( int index );
85  void on_mBlendCmbBx_currentIndexChanged( int index );
86  void on_mTransparencySlider_valueChanged( int value );
87 
88 };
89 
90 
91 
92 #include "ui_widget_blur.h"
93 
94 class GUI_EXPORT QgsBlurWidget : public QgsPaintEffectWidget, private Ui::WidgetBlur
95 {
96  Q_OBJECT
97 
98  public:
99  QgsBlurWidget( QWidget* parent = nullptr );
100 
101  static QgsPaintEffectWidget* create() { return new QgsBlurWidget(); }
102 
103  virtual void setPaintEffect( QgsPaintEffect* effect ) override;
104 
105  private:
106  QgsBlurEffect* mEffect;
107 
108  void initGui();
109  void blockSignals( const bool block );
110 
111  private slots:
112 
113  void on_mBlurTypeCombo_currentIndexChanged( int index );
114  void on_mBlurStrengthSpnBx_valueChanged( int value );
115  void on_mTransparencySpnBx_valueChanged( double value );
116  void on_mDrawModeComboBox_currentIndexChanged( int index );
117  void on_mBlendCmbBx_currentIndexChanged( int index );
118  void on_mTransparencySlider_valueChanged( int value );
119 
120 };
121 
122 
123 
124 #include "ui_widget_shadoweffect.h"
125 
126 class GUI_EXPORT QgsShadowEffectWidget : public QgsPaintEffectWidget, private Ui::WidgetShadowEffect
127 {
128  Q_OBJECT
129 
130  public:
131  QgsShadowEffectWidget( QWidget* parent = nullptr );
132 
134 
135  virtual void setPaintEffect( QgsPaintEffect* effect ) override;
136 
137  private:
138  QgsShadowEffect* mEffect;
139 
140  void initGui();
141  void blockSignals( const bool block );
142 
143  private slots:
144  void on_mShadowOffsetAngleSpnBx_valueChanged( int value );
145  void on_mShadowOffsetAngleDial_valueChanged( int value );
146  void on_mShadowOffsetSpnBx_valueChanged( double value );
147  void on_mOffsetUnitWidget_changed();
148  void on_mShadowTranspSpnBx_valueChanged( double value );
149  void on_mShadowColorBtn_colorChanged( const QColor& color );
150  void on_mDrawModeComboBox_currentIndexChanged( int index );
151  void on_mShadowBlendCmbBx_currentIndexChanged( int index );
152  void on_mShadowRadiuSpnBx_valueChanged( int value );
153  void on_mShadowTranspSlider_valueChanged( int value );
154 };
155 
156 
157 #include "ui_widget_glow.h"
158 
159 class GUI_EXPORT QgsGlowWidget : public QgsPaintEffectWidget, private Ui::WidgetGlow
160 {
161  Q_OBJECT
162 
163  public:
164  QgsGlowWidget( QWidget* parent = nullptr );
165 
166  static QgsPaintEffectWidget* create() { return new QgsGlowWidget(); }
167 
168  virtual void setPaintEffect( QgsPaintEffect* effect ) override;
169 
170  private:
171  QgsGlowEffect* mEffect;
172 
173  void initGui();
174  void blockSignals( const bool block );
175 
176  private slots:
177  void colorModeChanged();
178  void on_mSpreadSpnBx_valueChanged( double value );
179  void on_mSpreadUnitWidget_changed();
180  void on_mTranspSpnBx_valueChanged( double value );
181  void on_mColorBtn_colorChanged( const QColor& color );
182  void on_mBlendCmbBx_currentIndexChanged( int index );
183  void on_mDrawModeComboBox_currentIndexChanged( int index );
184  void on_mBlurRadiusSpnBx_valueChanged( int value );
185  void on_mTranspSlider_valueChanged( int value );
186  void applyColorRamp();
187 
188 };
189 
190 #include "ui_widget_transform.h"
191 
192 class GUI_EXPORT QgsTransformWidget : public QgsPaintEffectWidget, private Ui::WidgetTransform
193 {
194  Q_OBJECT
195 
196  public:
197  QgsTransformWidget( QWidget* parent = nullptr );
198 
199  static QgsPaintEffectWidget* create() { return new QgsTransformWidget(); }
200 
201  virtual void setPaintEffect( QgsPaintEffect* effect ) override;
202 
203  private:
204  QgsTransformEffect* mEffect;
205 
206  void initGui();
207  void blockSignals( const bool block );
208 
209  private slots:
210 
211  void on_mDrawModeComboBox_currentIndexChanged( int index );
212  void on_mSpinTranslateX_valueChanged( double value );
213  void on_mSpinTranslateY_valueChanged( double value );
214  void on_mTranslateUnitWidget_changed();
215  void on_mReflectXCheckBox_stateChanged( int state );
216  void on_mReflectYCheckBox_stateChanged( int state );
217  void on_mSpinShearX_valueChanged( double value );
218  void on_mSpinShearY_valueChanged( double value );
219  void on_mSpinScaleX_valueChanged( double value );
220  void on_mSpinScaleY_valueChanged( double value );
221  void on_mRotationSpinBox_valueChanged( double value );
222 
223 };
224 
225 
226 #include "ui_widget_coloreffects.h"
227 
228 class GUI_EXPORT QgsColorEffectWidget : public QgsPaintEffectWidget, private Ui::WidgetColorEffect
229 {
230  Q_OBJECT
231 
232  public:
233  QgsColorEffectWidget( QWidget* parent = nullptr );
234 
236 
237  virtual void setPaintEffect( QgsPaintEffect* effect ) override;
238 
239  private:
240  QgsColorEffect* mEffect;
241 
242  void initGui();
243  void blockSignals( const bool block );
244  void enableColorizeControls( const bool enable );
245 
246  private slots:
247 
248  void on_mTranspSpnBx_valueChanged( double value );
249  void on_mBlendCmbBx_currentIndexChanged( int index );
250  void on_mDrawModeComboBox_currentIndexChanged( int index );
251  void on_mTranspSlider_valueChanged( int value );
252  void on_mBrightnessSpinBox_valueChanged( int value );
253  void on_mContrastSpinBox_valueChanged( int value );
254  void on_mSaturationSpinBox_valueChanged( int value );
255  void on_mColorizeStrengthSpinBox_valueChanged( int value );
256  void on_mColorizeCheck_stateChanged( int state );
257  void on_mColorizeColorButton_colorChanged( const QColor& color );
258  void on_mGrayscaleCombo_currentIndexChanged( int index );
259 
260 };
261 
262 
263 
264 #endif //QGSPAINTEFFECTWIDGET_H
static unsigned index
Base class for effect properties widgets.
Base class for visual effects which can be applied to QPicture drawings.
Base class for paint effect which draw a glow inside or outside a picture.
Definition: qgsgloweffect.h:34
static QgsPaintEffectWidget * create()
QgsPaintEffectWidget(QWidget *parent=nullptr)
A paint effect which blurs a source picture, using a number of different blur methods.
Definition: qgsblureffect.h:32
static QgsPaintEffectWidget * create()
bool blockSignals(bool block)
A paint effect which applies transformations (such as move, scale and rotate) to a picture...
virtual void setPaintEffect(QgsPaintEffect *effect)=0
Sets the paint effect to modify with the widget.
A paint effect which alters the colors (eg brightness, contrast) in a source picture.
Base class for paint effects which offset, blurred shadows.
static QgsPaintEffectWidget * create()
static QgsPaintEffectWidget * create()
A paint effect which draws the source picture with minor or no alterations.
static QgsPaintEffectWidget * create()
static QgsPaintEffectWidget * create()