Results 1 to 3 of 3

Thread: resizeEvent destroy my QPropertyAnimation

  1. #1
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default resizeEvent destroy my QPropertyAnimation

    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
    Qt Code:
    1. animation_enabled->setTargetObject( button );
    2. animation_enabled->setPropertyName( "pos" );
    3. animation_enabled->setDuration( 100 );
    4. animation_enabled->setEndValue( QPoint( button->pos().x(), animation_pos_end ) );
    5.  
    6. animation_enabled->start();
    To copy to clipboard, switch view to plain text mode 

    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?
    animation.JPG
    bad_animation.JPG

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: resizeEvent destroy my QPropertyAnimation

    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,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    atomic (14th February 2014)

  4. #3
    Join Date
    Jan 2014
    Posts
    76
    Thanks
    17
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: resizeEvent destroy my QPropertyAnimation

    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

Similar Threads

  1. Destroy object
    By Viper666 in forum Qt Programming
    Replies: 6
    Last Post: 5th January 2013, 14:43
  2. destroy QHBoxLayout
    By maarvi in forum Newbie
    Replies: 2
    Last Post: 28th June 2011, 07:13
  3. How to destroy an object right
    By Cruz in forum Newbie
    Replies: 7
    Last Post: 22nd January 2009, 19:43
  4. Object Not destroy
    By Sudhanshu Sharma in forum Qt Programming
    Replies: 3
    Last Post: 30th July 2008, 23:16
  5. Replies: 1
    Last Post: 24th June 2006, 20:55

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.