Two GraphicsEffects for one QWidget?
is it possible to apply two different QPropertyAnimations to one QWidget?
I'd like to visualize QPushButtons with a dropshadow as well as be able to change the opacity while states are changing.
QGraphicsOpacityEffect* opacity = new QGraphicsOpacityEffect(); opacity->setOpacity(0.5); pushButton->setGraphicsEffect(opacity);
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect(); shadow->setBlurRadius(8); shadow->setOffset(2, 2); pushButton->setGraphicsEffect(shadow);
I only get the last one working which has be applied. Is there a way to apply both effects at the same time?
Any help is much appreciated!
I have tried before to have two Dropshadow effects on one QGraphicsView. But I also failed. I could get only one effect. As far as I remember, when I googled it, the result was negative.
In Qt document
Sets effect as the widget's effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new effect.
Well that's disappointing.. guess I have to come across with a neat idea myself. :)
Anyways, thank you very much for your quick reply!!!
@samdol... since the key is the QGraphicsEffect parent class, have you tried deriving a new combined or creating a QGraphicsEffectGroup that allows you to add multiple groups? This seems like it would be a good solution for your needs.
This was really meant for @Sebbo ! Typo
Sorry for the late reply. Didn't try to group the effects but solved the issue with applying new effects while being in different states. This was sufficient for my purposes.