QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgseffectstack.h
Go to the documentation of this file.
1/***************************************************************************
2 qgseffectstack.h
3 ----------------
4 begin : December 2014
5 copyright : (C) 2014 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSEFFECTSTACK_H
18#define QGSEFFECTSTACK_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgspainteffect.h"
23
24#include <QString>
25
26using namespace Qt::StringLiterals;
27
46
48{
49 public:
56 static QgsPaintEffect *create( const QVariantMap &map ) SIP_FACTORY;
57
58 QgsEffectStack() = default;
59
60 QgsEffectStack( const QgsEffectStack &other );
61
66
72 explicit QgsEffectStack( const QgsPaintEffect &effect );
73
74 ~QgsEffectStack() override;
75
76 Qgis::PaintEffectFlags flags() const override;
77 QString type() const override { return u"effectStack"_s; }
78 QgsEffectStack *clone() const override SIP_FACTORY;
79 bool saveProperties( QDomDocument &doc, QDomElement &element ) const override;
80 bool readProperties( const QDomElement &element ) override;
81
85 QVariantMap properties() const override;
86
90 void readProperties( const QVariantMap &props ) override;
91
98 void appendEffect( QgsPaintEffect *effect SIP_TRANSFER );
99
107 bool insertEffect( int index, QgsPaintEffect *effect SIP_TRANSFER );
108
115 bool changeEffect( int index, QgsPaintEffect *effect SIP_TRANSFER );
116
121 QgsPaintEffect *takeEffect( int index SIP_TRANSFERBACK );
122
128 QList< QgsPaintEffect * > *effectList();
129
134 int count() const { return mEffectList.count(); }
135
141 QgsPaintEffect *effect( int index ) const;
142
143 QgsEffectStack &operator=( const QgsEffectStack &rhs );
144
145 QgsEffectStack &operator=( QgsEffectStack &&other ) SIP_SKIP;
146
147
148 protected:
149 void draw( QgsRenderContext &context ) override;
150
151 private:
152 QList< QgsPaintEffect * > mEffectList;
153
154 void clearStack();
155};
156
157#endif // QGSEFFECTSTACK_H
QFlags< PaintEffectFlag > PaintEffectFlags
Flags which control how paint effects behave.
Definition qgis.h:2912
A paint effect which consists of a stack of other chained paint effects.
QgsEffectStack()=default
QString type() const override
Returns the effect type.
static QgsPaintEffect * create(const QVariantMap &map)
Creates a new QgsEffectStack effect.
int count() const
Returns count of effects contained by the stack.
QgsPaintEffect * effect(int index) const
Returns a pointer to the effect at a specified index within the stack.
Base class for visual effects which can be applied to QPicture drawings.
QgsPaintEffect()=default
friend class QgsEffectStack
virtual Qgis::PaintEffectFlags flags() const
Returns flags which specify how the paint effect behaves.
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
virtual void draw(QgsRenderContext &context)=0
Handles drawing of the effect's result on to the specified render context.
Contains information about the context of a rendering operation.
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_TRANSFERBACK
Definition qgis_sip.h:47
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_NODEFAULTCTORS
Definition qgis_sip.h:108