QPropertyAnimation menubar
Unsolved
General and Desktop
-
Hi @Yacinoben
I think that you need to use the
QPropertyAnimation
withQGraphicsOpacityEffect
:Here is a simple animation example with
QPushButton
:#include "mainwindow.h" #include <QApplication> #include <QGraphicsOpacityEffect> #include <QPropertyAnimation> #include <QPushButton> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; QGraphicsOpacityEffect *opacity = new QGraphicsOpacityEffect; QPropertyAnimation *anim = new QPropertyAnimation( opacity, "opacity" ); QPushButton *animatedButton = new QPushButton( "Animation", &w ); animatedButton->setGraphicsEffect( opacity ); anim->setDuration( 2000 ); anim->setStartValue( 0.1 ); anim->setEndValue( 1.0 ); anim->setEasingCurve( QEasingCurve::InCubic ); anim->start(); w.show(); return a.exec(); }
You can get inspired from this example to achieve your animation.
To go further i advise you to read the Qt Animation overview