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?
For the second problem, I would suggest wrapping everything inside the widget in another widget, which has a fixed size. Due to the clipping of widgets, this means the widget will show portions of the fully-sized widgets while it animates.
For the crash, I'd recommend grabbing a stack trace and, assuming the problem isn't in your code, report it as a bug .
For the second, rather than render the widget exactly where you want it with different sizes, render it as you'd like it to be seen. For example:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.