Qt: Animating the 'roll down' of a QWidget
Posted
by eAi
on Stack Overflow
See other posts from Stack Overflow
or by eAi
Published on 2010-06-10T16:28:11Z
Indexed on
2010/06/10
23:32 UTC
Read the original article
Hit count: 218
I have a QWidget that contains various other widgets. I want to animate it appearing on the screen by gradually revealing it from the top down, increasing it's height from 0 to whatever it's natural height would be.
The way I have it currently is:
mAnimation = new QPropertyAnimation(this, "maximumHeight");
mAnimation->setStartValue(0);
mAnimation->setEndValue(400);
mAnimation->start();
This has two issues: - It crashes when the height reaches a certain height, with a "qDrawShadeRect: Invalid parameters" error. - If I change the 0 to 100, it works fine, but the widgets contained within the QWidget I'm animating have their layout changed as the widget animates, starting very squashed together and gradually spreading apart as they get more space. This looks ugly!
Does anyone have any suggestions?
© Stack Overflow or respective owner