I need to animate widget transparency.
It seems to me, that I should use QPropertyAnimation. But how could i define widget translucent? Should I use something like this?
Qt – How to animate widget transparency in Qt4
qtqt4
qtqt4
I need to animate widget transparency.
It seems to me, that I should use QPropertyAnimation. But how could i define widget translucent? Should I use something like this?
Best Answer
There are two sub-answers to your question, from what I've played with at least:
opacity
. Unfortunately, this means using proxy widgets QGrapgicsProxyWidget to keep normal widgets in sync with their graphics widget counterparts since QGraphicsWidget doesn't inherit QWidget. To find out more, check out the Animation Framework Examples, in particular the State Machine for how to use proxy widgets.For
windowOpacity
animations:QPropertyAnimation animate = new QPropertyAnimation(this, "windowOpacity", this);
animate.setDuration(100); animate.setStartValue(1); animate.setEndValue(0);
animate.start();
This will work only on systems that support some kind of Composite extension.
Hope it helps!