Search code examples
qtqt4widgeteffectstransition

Transition effect when showing a custom widget in Qt


I would like to progressively show a custom widget, something like beginning with 0 opacity and going to 100 in a given time. Is it possible to do it in a easy Qt way developed for this purpose? Or may I do it by myself?

Cheers,


Solution

  • It would be simpler to use QGraphicsOpacityEffect with QPropertyAnimation, which was made exactly for stuff like this. All you need to do is to attach your QGraphicsOpacityEffect to your QWidget descendant then set it up as the target for a newly created QPropertyAnimation and run QPropertyAnimation with your desired options!