In my plugin I want to set up a 'halo'-effect like this: enter image description here

So far I tried this:

setting up the paint effect:

    QgsPaintEffect * p_mPaintEffect(0);
    p_mPaintEffect= new QgsOuterGlowEffect();


assign it with the symbollayer:


After opening the layer properties dialog there is only one painteffect not like in the image above a list of 5. But I don't know how to set more effects. Where can I get the list? In API is only documented to set one effect.


Sorry for answering my own question. After browsing the API I found the solution is to cast the QgsPaintEffect to QgsEffectStack and edit the existing effects, maybe someone can benefit from this code:

    QgsPaintEffect* oldEffect=p_Symbol->symbolLayer(0)->paintEffect();
    QgsEffectStack* stackEffect=(static_cast<QgsEffectStack*>(oldEffect));

    for(int j=0; j< stackEffect->count();j++)
        if (stackEffect->effect(j)->type()=="outerGlow" )
            stackEffect->changeEffect (j,effect);
        else if (stackEffect->effect(j)->type()=="drawSource" )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.