QGIS API Documentation  2.14.0-Essen
qgseffectstackpropertieswidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgseffectstackpropertieswidget.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 QGSEFFECTSTACKPROPERTIESWIDGET_H
17 #define QGSEFFECTSTACKPROPERTIESWIDGET_H
18 
19 #include "qgsdialog.h"
20 #include "effects/qgseffectstack.h"
21 #include <QWidget>
22 #include <QStandardItemModel>
23 
24 #include "ui_qgseffectstackpropertieswidgetbase.h"
25 
26 class EffectItem;
27 class QgsPaintEffect;
28 class QCheckBox;
29 class QToolButton;
30 
42 class GUI_EXPORT QgsEffectStackPropertiesWidget : public QWidget, private Ui::QgsEffectStackPropertiesWidgetBase
43 {
44  Q_OBJECT
45 
46  public:
47 
52  QgsEffectStackPropertiesWidget( QgsEffectStack* stack, QWidget* parent = nullptr );
53 
55 
59  QgsEffectStack* stack() { return mStack; }
60 
64  void setPreviewPicture( const QPicture& picture );
65 
66  public slots:
67 
70  void moveEffectDown();
71 
74  void moveEffectUp();
75 
78  void addEffect();
79 
82  void removeEffect();
83 
86  void effectChanged();
87 
90  void updatePreview();
91 
95  void changeEffect( QgsPaintEffect* newEffect );
96 
97  protected:
98 
103 
106  void loadStack();
107 
111  void loadStack( QgsEffectStack* stack );
112 
115  void updateUi();
116 
120  EffectItem* currentEffectItem();
121 
124  void moveEffectByOffset( int offset );
125 
128  void setWidget( QWidget* widget );
129 
130 };
131 
132 
145 {
146  Q_OBJECT
147 
148  public:
149 
155  QgsEffectStackPropertiesDialog( QgsEffectStack* stack, QWidget* parent = nullptr, const Qt::WindowFlags& f = nullptr );
157 
161  QgsEffectStack* stack();
162 
166  void setPreviewPicture( const QPicture& picture );
167 
168  protected:
169 
171 
172 };
173 
174 
186 class GUI_EXPORT QgsEffectStackCompactWidget: public QWidget
187 {
188  Q_OBJECT
189 
190  public:
191 
198  QgsEffectStackCompactWidget( QWidget* parent = nullptr, QgsPaintEffect* effect = nullptr );
200 
207  void setPaintEffect( QgsPaintEffect* effect );
208 
213  QgsPaintEffect* paintEffect() const { return mStack; }
214 
218  void setPreviewPicture( const QPicture &picture );
219 
220  signals:
221 
224  void changed();
225 
226  private slots:
227 
228  void showDialog();
229 
230  void enableToggled( bool checked );
231 
232  private:
233 
234  QgsEffectStack* mStack;
235  QCheckBox* mEnabledCheckBox;
236  QToolButton* mButton;
237  QPicture* mPreviewPicture;
238 
239 };
240 
241 #endif //QGSEFFECTSTACKPROPERTIESWIDGET_H
A dialog for modifying the properties of a QgsEffectStack, including adding and reordering effects wi...
Base class for visual effects which can be applied to QPicture drawings.
A generic dialog with layout and button box.
Definition: qgsdialog.h:30
A widget for modifying the properties of a QgsEffectStack, including adding and reordering effects wi...
QgsEffectStack * stack()
Returns effect stack attached to the widget.
A small widget consisting of a check box for enabling/disabling an effect stack and a button for open...
A paint effect which consists of a stack of other chained paint effects.
QgsEffectStackPropertiesWidget * mPropertiesWidget
typedef WindowFlags
QgsPaintEffect * paintEffect() const
Returns paint effect attached to the widget.