QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 #include "qgis_sip.h"
21 #include "qgis_gui.h"
22 
23 class QgsPaintEffect;
24 class QgsShadowEffect;
26 class QgsBlurEffect;
27 class QgsGlowEffect;
28 class QgsTransformEffect;
29 class QgsColorEffect;
30 
31 
40 class GUI_EXPORT QgsPaintEffectWidget : public QWidget
41 {
42  Q_OBJECT
43 
44  public:
45  QgsPaintEffectWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr ) : QWidget( parent ) {}
46 
51  virtual void setPaintEffect( QgsPaintEffect *effect ) = 0;
52 
53  signals:
54 
58  void changed();
59 
60 };
61 
62 //individual effect widgets
63 
64 #include "ui_widget_drawsource.h"
65 
70 class GUI_EXPORT QgsDrawSourceWidget : public QgsPaintEffectWidget, private Ui::WidgetDrawSource
71 {
72  Q_OBJECT
73 
74  public:
75  QgsDrawSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
76 
78 
79  void setPaintEffect( QgsPaintEffect *effect ) override;
80 
81  private:
82  QgsDrawSourceEffect *mEffect = nullptr;
83 
84  void initGui();
85  void blockSignals( bool block );
86 
87  private slots:
88 
89  void opacityChanged( double value );
90  void mDrawModeComboBox_currentIndexChanged( int index );
91  void mBlendCmbBx_currentIndexChanged( int index );
92 
93 };
94 
95 
96 
97 #include "ui_widget_blur.h"
98 
103 class GUI_EXPORT QgsBlurWidget : public QgsPaintEffectWidget, private Ui::WidgetBlur
104 {
105  Q_OBJECT
106 
107  public:
108  QgsBlurWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
109 
111 
112  void setPaintEffect( QgsPaintEffect *effect ) override;
113 
114  private:
115  QgsBlurEffect *mEffect = nullptr;
116 
117  void initGui();
118  void blockSignals( bool block );
119 
120  private slots:
121 
122  void mBlurTypeCombo_currentIndexChanged( int index );
123  void mBlurStrengthSpnBx_valueChanged( double value );
124  void mBlurUnitWidget_changed();
125  void opacityChanged( double value );
126  void mDrawModeComboBox_currentIndexChanged( int index );
127  void mBlendCmbBx_currentIndexChanged( int index );
128 
129 };
130 
131 
132 
133 #include "ui_widget_shadoweffect.h"
134 
139 class GUI_EXPORT QgsShadowEffectWidget : public QgsPaintEffectWidget, private Ui::WidgetShadowEffect
140 {
141  Q_OBJECT
142 
143  public:
144  QgsShadowEffectWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
145 
147 
148  void setPaintEffect( QgsPaintEffect *effect ) override;
149 
150  private:
151  QgsShadowEffect *mEffect = nullptr;
152 
153  void initGui();
154  void blockSignals( bool block );
155 
156  private slots:
157  void mShadowOffsetAngleSpnBx_valueChanged( int value );
158  void mShadowOffsetAngleDial_valueChanged( int value );
159  void mShadowOffsetSpnBx_valueChanged( double value );
160  void mOffsetUnitWidget_changed();
161  void opacityChanged( double value );
162  void mShadowColorBtn_colorChanged( const QColor &color );
163  void mDrawModeComboBox_currentIndexChanged( int index );
164  void mShadowBlendCmbBx_currentIndexChanged( int index );
165  void mShadowRadiuSpnBx_valueChanged( double value );
166  void mBlurUnitWidget_changed();
167 };
168 
169 
170 #include "ui_widget_glow.h"
171 
176 class GUI_EXPORT QgsGlowWidget : public QgsPaintEffectWidget, private Ui::WidgetGlow
177 {
178  Q_OBJECT
179 
180  public:
181  QgsGlowWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
182 
184 
185  void setPaintEffect( QgsPaintEffect *effect ) override;
186 
187  private:
188  QgsGlowEffect *mEffect = nullptr;
189 
190  void initGui();
191  void blockSignals( bool block );
192 
193  private slots:
194  void colorModeChanged();
195  void mSpreadSpnBx_valueChanged( double value );
196  void mSpreadUnitWidget_changed();
197  void opacityChanged( double value );
198  void mColorBtn_colorChanged( const QColor &color );
199  void mBlendCmbBx_currentIndexChanged( int index );
200  void mDrawModeComboBox_currentIndexChanged( int index );
201  void mBlurRadiusSpnBx_valueChanged( double value );
202  void mBlurUnitWidget_changed();
203  void applyColorRamp();
204 
205 };
206 
207 #include "ui_widget_transform.h"
208 
213 class GUI_EXPORT QgsTransformWidget : public QgsPaintEffectWidget, private Ui::WidgetTransform
214 {
215  Q_OBJECT
216 
217  public:
218  QgsTransformWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
219 
221 
222  void setPaintEffect( QgsPaintEffect *effect ) override;
223 
224  private:
225  QgsTransformEffect *mEffect = nullptr;
226 
227  void initGui();
228  void blockSignals( bool block );
229 
230  private slots:
231 
232  void mDrawModeComboBox_currentIndexChanged( int index );
233  void mSpinTranslateX_valueChanged( double value );
234  void mSpinTranslateY_valueChanged( double value );
235  void mTranslateUnitWidget_changed();
236  void mReflectXCheckBox_stateChanged( int state );
237  void mReflectYCheckBox_stateChanged( int state );
238  void mSpinShearX_valueChanged( double value );
239  void mSpinShearY_valueChanged( double value );
240  void mSpinScaleX_valueChanged( double value );
241  void mSpinScaleY_valueChanged( double value );
242  void mRotationSpinBox_valueChanged( double value );
243 
244 };
245 
246 
247 #include "ui_widget_coloreffects.h"
248 
253 class GUI_EXPORT QgsColorEffectWidget : public QgsPaintEffectWidget, private Ui::WidgetColorEffect
254 {
255  Q_OBJECT
256 
257  public:
258  QgsColorEffectWidget( QWidget *parent = nullptr );
259 
261 
262  void setPaintEffect( QgsPaintEffect *effect ) override;
263 
264  private:
265  QgsColorEffect *mEffect = nullptr;
266 
267  void initGui();
268  void blockSignals( bool block );
269  void enableColorizeControls( bool enable );
270 
271  private slots:
272 
273  void opacityChanged( double value );
274  void mBlendCmbBx_currentIndexChanged( int index );
275  void mDrawModeComboBox_currentIndexChanged( int index );
276  void mBrightnessSpinBox_valueChanged( int value );
277  void mContrastSpinBox_valueChanged( int value );
278  void mSaturationSpinBox_valueChanged( int value );
279  void mColorizeStrengthSpinBox_valueChanged( int value );
280  void mColorizeCheck_stateChanged( int state );
281  void mColorizeColorButton_colorChanged( const QColor &color );
282  void mGrayscaleCombo_currentIndexChanged( int index );
283 
284 };
285 
286 
287 
288 #endif //QGSPAINTEFFECTWIDGET_H
QgsDrawSourceWidget::create
static QgsPaintEffectWidget * create()
Definition: qgspainteffectwidget.h:77
QgsBlurEffect
A paint effect which blurs a source picture, using a number of different blur methods.
Definition: qgsblureffect.h:35
QgsTransformWidget
Definition: qgspainteffectwidget.h:214
QgsPaintEffectWidget::QgsPaintEffectWidget
QgsPaintEffectWidget(QWidget *parent=nullptr)
Definition: qgspainteffectwidget.h:45
QgsDrawSourceWidget
Definition: qgspainteffectwidget.h:71
QgsColorEffectWidget
Definition: qgspainteffectwidget.h:254
QgsBlurWidget
Definition: qgspainteffectwidget.h:104
QgsPaintEffectWidget::changed
void changed()
Emitted when properties of the effect are changed through the widget.
QgsDrawSourceEffect
A paint effect which draws the source picture with minor or no alterations.
Definition: qgspainteffect.h:329
QgsColorEffect
A paint effect which alters the colors (e.g., brightness, contrast) in a source picture.
Definition: qgscoloreffect.h:36
QgsColorEffectWidget::create
static QgsPaintEffectWidget * create()
Definition: qgspainteffectwidget.h:260
QgsShadowEffectWidget
Definition: qgspainteffectwidget.h:140
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsGlowEffect
Base class for paint effect which draw a glow inside or outside a picture.
Definition: qgsgloweffect.h:39
qgis_sip.h
QgsPaintEffectWidget::setPaintEffect
virtual void setPaintEffect(QgsPaintEffect *effect)=0
Sets the paint effect to modify with the widget.
QgsPaintEffectWidget
Base class for effect properties widgets.
Definition: qgspainteffectwidget.h:41
QgsGlowWidget::create
static QgsPaintEffectWidget * create()
Definition: qgspainteffectwidget.h:183
QgsShadowEffectWidget::create
static QgsPaintEffectWidget * create()
Definition: qgspainteffectwidget.h:146
QgsGlowWidget
Definition: qgspainteffectwidget.h:177
QgsTransformEffect
A paint effect which applies transformations (such as move, scale and rotate) to a picture.
Definition: qgstransformeffect.h:37
QgsBlurWidget::create
static QgsPaintEffectWidget * create()
Definition: qgspainteffectwidget.h:110
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:54
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsShadowEffect
Base class for paint effects which offset, blurred shadows.
Definition: qgsshadoweffect.h:35
QgsTransformWidget::create
static QgsPaintEffectWidget * create()
Definition: qgspainteffectwidget.h:220