Qt: Animating the 'roll down' of a QWidget
- by eAi
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?