27   for ( 
int i = 0; i < other.
count(); ++i )
    36   std::swap( mEffectList, other.mEffectList );
    56   for ( 
int i = 0; i < rhs.
count(); ++i )
    66   std::swap( mEffectList, other.mEffectList );
    80   QPainter *destPainter = context.
painter();
    85   QPicture *sourcePic = 
new QPicture( *
source() );
    86   QPicture *currentPic = sourcePic;
    87   QList< QPicture * > results;
    88   for ( 
int i = mEffectList.count() - 1; i >= 0; --i )
    96     QPicture *pic = 
nullptr;
    97     if ( effect->
type() == QLatin1String( 
"drawSource" ) )
   107     QPicture *resultPic = 
new QPicture();
   108     QPainter p( resultPic );
   113     effect->
render( *pic, context );
   117     results << resultPic;
   120       currentPic = resultPic;
   128   for ( 
int i = 0; i < mEffectList.count(); ++i )
   130     if ( !mEffectList[i]->
enabled() )
   135     QPicture *pic = results.takeLast();
   140       context.
painter()->drawPicture( 0, 0, *pic );
   156   if ( element.isNull() )
   161   QDomElement effectElement = doc.createElement( QStringLiteral( 
"effect" ) );
   162   effectElement.setAttribute( QStringLiteral( 
"type" ), 
type() );
   163   effectElement.setAttribute( QStringLiteral( 
"enabled" ), 
mEnabled );
   172   element.appendChild( effectElement );
   178   if ( element.isNull() )
   183   mEnabled = ( element.attribute( QStringLiteral( 
"enabled" ), QStringLiteral( 
"0" ) ) != QLatin1String( 
"0" ) );
   188   QDomNodeList childNodes = element.childNodes();
   189   for ( 
int i = 0; i < childNodes.size(); ++i )
   191     QDomElement childElement = childNodes.at( i ).toElement();
   210 void QgsEffectStack::clearStack()
   212   qDeleteAll( mEffectList );
   218   mEffectList.append( effect );
   223   if ( index < 0 || index > mEffectList.count() )
   228   mEffectList.insert( index, effect );
   234   if ( index < 0 || index >= mEffectList.count() )
   239   delete mEffectList.at( index );
   240   mEffectList[index] = 
effect;
   246   if ( index < 0 || index >= mEffectList.count() )
   249   return mEffectList.takeAt( index );
   259   if ( index >= 0 && index < mEffectList.count() )
   261     return mEffectList.at( index );
 
bool insertEffect(int index, QgsPaintEffect *effect)
Inserts an effect at a specified index within the stack. 
 
The result of the effect is rendered on the destination, but does not affect subsequent effects in th...
 
bool enabled() const 
Returns whether the effect is enabled. 
 
Base class for visual effects which can be applied to QPicture drawings. 
 
~QgsEffectStack() override
 
void draw(QgsRenderContext &context) override
Handles drawing of the effect's result on to the specified render context. 
 
QMap< QString, QString > QgsStringMap
 
static QgsPaintEffectRegistry * paintEffectRegistry()
Returns the application's paint effect registry, used for managing paint effects. ...
 
bool saveProperties(QDomDocument &doc, QDomElement &element) const override
Saves the current state of the effect to a DOM element. 
 
bool readProperties(const QDomElement &element) override
Restores the effect to the state described by a DOM element. 
 
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect. 
 
static QgsPaintEffect * create(const QgsStringMap &map)
Creates a new QgsEffectStack effect. 
 
int count() const 
Returns count of effects contained by the stack. 
 
virtual QString type() const =0
Returns the effect type. 
 
QString type() const override
Returns the effect type. 
 
void setPainter(QPainter *p)
Sets the destination QPainter for the render operation. 
 
void fixQPictureDpi(QPainter *painter) const 
Applies a workaround to a QPainter to avoid an issue with incorrect scaling when drawing QPictures...
 
A paint effect which consists of a stack of other chained paint effects. 
 
QgsEffectStack * clone() const override
Duplicates an effect by creating a deep copy of the effect. 
 
void appendEffect(QgsPaintEffect *effect)
Appends an effect to the end of the stack. 
 
The result of the effect is not rendered, but is passed on to following effects in the stack...
 
bool requiresQPainterDpiFix
 
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const 
Saves the current state of the effect to a DOM element. 
 
Contains information about the context of a rendering operation. 
 
QPainter * painter()
Returns the destination QPainter for the render operation. 
 
QList< QgsPaintEffect * > * effectList()
Returns a pointer to the list of effects currently contained by the stack. 
 
QgsEffectStack & operator=(const QgsEffectStack &rhs)
 
virtual void render(QPicture &picture, QgsRenderContext &context)
Renders a picture using the effect. 
 
QgsPaintEffect * takeEffect(int index)
Removes an effect from the stack and returns a pointer to it. 
 
const QPicture * source() const 
Returns the source QPicture. 
 
QgsStringMap properties() const override
Unused for QgsEffectStack, will always return an empty string map. 
 
QgsEffectStack()=default
Constructor for empty QgsEffectStack. 
 
QgsPaintEffect * effect(int index) const 
Returns a pointer to the effect at a specified index within the stack. 
 
bool changeEffect(int index, QgsPaintEffect *effect)
Replaces the effect at a specified position within the stack. 
 
QgsPaintEffect * createEffect(const QString &name, const QgsStringMap &properties=QgsStringMap()) const 
Creates a new paint effect given the effect name and properties map.