PDA

View Full Version : resizeEvent destroy my QPropertyAnimation



atomic
30th January 2014, 21:00
Hi, i am new user and my english is not a best so please for your understanding ;)

I have a few QToolButton in QToolBar which animates with QPropertAnimation. Something like this


animation_enabled->setTargetObject( button );
animation_enabled->setPropertyName( "pos" );
animation_enabled->setDuration( 100 );
animation_enabled->setEndValue( QPoint( button->pos().x(), animation_pos_end ) );

animation_enabled->start();


the problem is that when the animation is running and i change size of the main window my animation changing positions. Why it happens and what i am doing wrong?
9993
9994

anda_skoa
31st January 2014, 11:35
The resize causes a re-layouting of the window and most likely also of the toolbar, which potentially modifies the positions and sizes of the widgets inside the layouts.

You probably have to recalculate the animation values based on the new base values.

Cheers,
_

atomic
14th February 2014, 20:57
Thanks for reply, you were right ;)
The problem was that the QToolBar inside keept items in layout and when i resize MainWindow then layout inside QToolBar also resize. I solve this problem trought placement items in widget, set minimumSize() and add this widget to QToolBar.
Thanks again ;)