Make sure window is animated on show()
-
Is it possible to ensure a window is animated when shown?
So, basically when you create a new dialog it gets shown popping up in a little animation. Then if you kill it or show it again it just appears or disappears. Is there a way to make it animated on hide and show? In particular, for showing.
-
Try "QPropertyAnimation":http://qt-project.org/doc/qt-4.8/qpropertyanimation.html
-
How do I use that for showing? Also, I think the window manger does something different for MS Windows. Maybe I need to delete cached information about the window or something. I noticed that when the window is shown the first time it animates.
-
Not sure if this "link":http://stackoverflow.com/questions/3283587/qwidget-resize-animation will directly solve your problem, but try reading it. It will give you insights on how to implement it.
-
do something like this in your dialog window class:
@
void MyDialog::showEvent(QShowEvent* event)
{
QDialog::showEvent(event);QPropertyAnimation* anim = new QPropertyAnimation(this, "windowOpacity"); anim->setStartValue(0.0); anim->setEndValue(1.0); anim->setDuration(1000); anim->start(QAbstractAnimation::DeleteWhenStopped);
}
@