QGIS API Documentation  3.2.0-Bonn (bc43194)
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 "qgis_sip.h"
21 #include "qgis.h"
22 #include <QWidget>
23 #include <QStandardItemModel>
24 #include "qgspanelwidget.h"
25 
26 #include "ui_qgseffectstackpropertieswidgetbase.h"
27 #include "qgis_gui.h"
28 
29 class EffectItem;
30 class QgsPaintEffect;
31 class QCheckBox;
32 class QToolButton;
33 class QgsPanelWidget;
34 class QgsEffectStack;
35 class QgsPaintEffect;
36 
49 class GUI_EXPORT QgsEffectStackPropertiesWidget : public QgsPanelWidget, private Ui::QgsEffectStackPropertiesWidgetBase
50 {
51  Q_OBJECT
52 
53  public:
54 
60  QgsEffectStackPropertiesWidget( QgsEffectStack *stack, QWidget *parent SIP_TRANSFERTHIS = nullptr );
61 
63 
68  QgsEffectStack *stack() { return mStack; }
69 
74  void setPreviewPicture( const QPicture &picture );
75 
76  public slots:
77 
81  void moveEffectDown();
82 
86  void moveEffectUp();
87 
91  void addEffect();
92 
96  void removeEffect();
97 
101  void effectChanged();
102 
106  void updatePreview();
107 
112  void changeEffect( QgsPaintEffect *newEffect );
113 
114  protected:
115 
116  QgsEffectStack *mStack = nullptr;
117  QStandardItemModel *mModel = nullptr;
118  QWidget *mPresentWidget = nullptr;
119  QPicture *mPreviewPicture = nullptr;
120 
124  void loadStack();
125 
130  void loadStack( QgsEffectStack *stack );
131 
135  void updateUi();
136 
141  EffectItem *currentEffectItem() SIP_SKIP;
142 
146  void moveEffectByOffset( int offset );
147 
151  void setWidget( QWidget *widget );
152 
153 };
154 
155 
169 {
170  Q_OBJECT
171 
172  public:
173 
180  QgsEffectStackPropertiesDialog( QgsEffectStack *stack, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags f = nullptr );
181 
186  QgsEffectStack *stack();
187 
192  void setPreviewPicture( const QPicture &picture );
193 
194  protected:
195 
196  QgsEffectStackPropertiesWidget *mPropertiesWidget = nullptr;
197 
198 };
199 
200 
214 {
215  Q_OBJECT
216 
217  public:
218 
226  QgsEffectStackCompactWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsPaintEffect *effect = nullptr );
227  ~QgsEffectStackCompactWidget() override;
228 
236  void setPaintEffect( QgsPaintEffect *effect );
237 
243  QgsPaintEffect *paintEffect() const;
244 
249  void setPreviewPicture( const QPicture &picture );
250 
251  signals:
252 
256  void changed();
257 
258  private slots:
259 
260  void showDialog();
261 
262  void enableToggled( bool checked );
263 
264  void updateAcceptWidget( QgsPanelWidget *panel );
265  void updateEffectLive();
266 
267  private:
268  QgsEffectStack *mStack = nullptr;
269  QCheckBox *mEnabledCheckBox = nullptr;
270  QToolButton *mButton = nullptr;
271  QPicture *mPreviewPicture = nullptr;
272 
273 };
274 
275 #endif //QGSEFFECTSTACKPROPERTIESWIDGET_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
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:33
Base class for any widget that can be shown as a inline panel.
A widget for modifying the properties of a QgsEffectStack, including adding and reordering effects wi...
#define SIP_SKIP
Definition: qgis_sip.h:119
QgsEffectStack * stack()
Returns effect stack attached to the widget.
A small widget consisting of a checkbox for enabling/disabling an effect stack and a button for openi...
A paint effect which consists of a stack of other chained paint effects.