QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 <QPicture>
25 #include "qgspanelwidget.h"
26 
27 #include "ui_qgseffectstackpropertieswidgetbase.h"
28 #include "qgis_gui.h"
29 
30 class EffectItem;
31 class QgsPaintEffect;
32 class QCheckBox;
33 class QToolButton;
34 class QgsPanelWidget;
35 class QgsEffectStack;
36 class QgsPaintEffect;
37 
50 class GUI_EXPORT QgsEffectStackPropertiesWidget : public QgsPanelWidget, private Ui::QgsEffectStackPropertiesWidgetBase
51 {
52  Q_OBJECT
53 
54  public:
55 
61  QgsEffectStackPropertiesWidget( QgsEffectStack *stack, QWidget *parent SIP_TRANSFERTHIS = nullptr );
62 
64 
69  QgsEffectStack *stack() { return mStack; }
70 
75  void setPreviewPicture( const QPicture &picture );
76 
77  public slots:
78 
82  void moveEffectDown();
83 
87  void moveEffectUp();
88 
92  void addEffect();
93 
97  void removeEffect();
98 
102  void effectChanged();
103 
107  void updatePreview();
108 
113  void changeEffect( QgsPaintEffect *newEffect );
114 
115  protected:
116 
117  QgsEffectStack *mStack = nullptr;
118  QStandardItemModel *mModel = nullptr;
119  QWidget *mPresentWidget = nullptr;
120  QPicture mPreviewPicture;
121 
125  void loadStack();
126 
131  void loadStack( QgsEffectStack *stack );
132 
136  void updateUi();
137 
142  EffectItem *currentEffectItem() SIP_SKIP;
143 
147  void moveEffectByOffset( int offset );
148 
152  void setWidget( QWidget *widget );
153 
154 };
155 
156 
170 {
171  Q_OBJECT
172 
173  public:
174 
181  QgsEffectStackPropertiesDialog( QgsEffectStack *stack, QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags f = Qt::WindowFlags() );
182 
187  QgsEffectStack *stack();
188 
193  void setPreviewPicture( const QPicture &picture );
194 
195  protected:
196 
197  QgsEffectStackPropertiesWidget *mPropertiesWidget = nullptr;
198 
199  private slots:
200 
201  void showHelp();
202 
203 };
204 
205 
219 {
220  Q_OBJECT
221 
222  public:
223 
231  QgsEffectStackCompactWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, QgsPaintEffect *effect = nullptr );
233 
241  void setPaintEffect( QgsPaintEffect *effect );
242 
248  QgsPaintEffect *paintEffect() const;
249 
254  void setPreviewPicture( const QPicture &picture );
255 
256  signals:
257 
261  void changed();
262 
263  private slots:
264 
265  void showDialog();
266 
267  void enableToggled( bool checked );
268 
269  void updateAcceptWidget( QgsPanelWidget *panel );
270  void updateEffectLive();
271 
272  private:
273  QgsEffectStack *mStack = nullptr;
274  QCheckBox *mEnabledCheckBox = nullptr;
275  QToolButton *mButton = nullptr;
276  QPicture mPreviewPicture;
277 
278 };
279 
280 #endif //QGSEFFECTSTACKPROPERTIESWIDGET_H
QgsEffectStackPropertiesWidget::mPreviewPicture
QPicture mPreviewPicture
Definition: qgseffectstackpropertieswidget.h:120
QgsEffectStackPropertiesWidget::stack
QgsEffectStack * stack()
Returns effect stack attached to the widget.
Definition: qgseffectstackpropertieswidget.h:69
QgsEffectStackCompactWidget::changed
void changed()
Emitted when the paint effect properties change.
qgis.h
QgsDialog
A generic dialog with layout and button box.
Definition: qgsdialog.h:34
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsPanelWidget
Base class for any widget that can be shown as a inline panel.
Definition: qgspanelwidget.h:30
QgsEffectStackCompactWidget
A small widget consisting of a checkbox for enabling/disabling an effect stack and a button for openi...
Definition: qgseffectstackpropertieswidget.h:219
QgsEffectStackCompactWidget::~QgsEffectStackCompactWidget
~QgsEffectStackCompactWidget() override
QgsEffectStackPropertiesWidget::~QgsEffectStackPropertiesWidget
~QgsEffectStackPropertiesWidget() override
qgis_sip.h
QgsEffectStackPropertiesWidget
A widget for modifying the properties of a QgsEffectStack, including adding and reordering effects wi...
Definition: qgseffectstackpropertieswidget.h:51
QgsEffectStackPropertiesDialog
A dialog for modifying the properties of a QgsEffectStack, including adding and reordering effects wi...
Definition: qgseffectstackpropertieswidget.h:170
QgsPaintEffect
Base class for visual effects which can be applied to QPicture drawings.
Definition: qgspainteffect.h:54
qgsdialog.h
qgspanelwidget.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
QgsEffectStack
A paint effect which consists of a stack of other chained paint effects.
Definition: qgseffectstack.h:45