I have the following problem: I want to resize a window using QPropertyAnimation, so as to look nice, but the window also instantly moves while the resizing takes place, while I don't want it to, I just want to resize the window and not to alter its position value.
So, here's my code:
animation = new QPropertyAnimation(this, "geometry");
animation->setDuration(150);
animation->setStartValue(QRect(preferences::x(), preferences::y(), width, window_height_min));
animation->setEndValue(QRect(preferences::x(), preferences::y(), width, window_height_min+expand_general_to));
animation->start();
where width and window_height_min and expand_general_to are my own variables that handle the amount of the resizing that has to be done. BUT, preferences::x() and preferences::y() truly handle the position of my window, so why it moves, while prefereces::x() will be the same both of the times? (in the start and in the end value) ?
Thanks in advance for any answers!
Please try to set size property.
animation = new QPropertyAnimation(this, "size");
animation->setDuration(150);
animation->setStartValue(QSize(width, window_height_min));
animation->setEndValue(QSize(width, window_height_min+expand_general_to));
animation->start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With