How to launch the QMainWindow with a fade in animation?
Unsolved
General and Desktop
-
I tried launching my window this way:
#include "stdafx.h" #include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { ui.setupUi(this); setWindowOpacity(0); QGraphicsOpacityEffect* eff = new QGraphicsOpacityEffect(this); QPropertyAnimation* ani = new QPropertyAnimation(eff, "windowOpacity"); ani->setDuration(3000); ani->setStartValue(0); ani->setEndValue(1); ani->setEasingCurve(QEasingCurve::OutBack); ani->start(QPropertyAnimation::DeleteWhenStopped); }
#include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }
But the window never became visible, I would like to it be initialized with a fade in effect.
What's the proper way to achieve it?