Results 1 to 3 of 3

Thread: QPropertyAnimation how to lock button slot to avoid reset of animation

  1. #1
    Join Date
    Dec 2011
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Question QPropertyAnimation how to lock button slot to avoid reset of animation

    i have this code:

    Qt Code:
    1. void myclass::on_btn_slot()
    2. {
    3. QPropertyAnimation *a = new QPropertyAnimation( ui->btn , "geometry" );
    4. a->setStart.....
    5. a->setEnd....
    6. a->setDuration...
    7. a->setLoopCount....
    8. a->start(QAbstractAnimation::Delete....);
    9. }
    To copy to clipboard, switch view to plain text mode 

    Once that animation is playing, how can I disable the call of the slot?
    Because then if I click during animation, this resets.

    I do not want to disable the button and I seek a solution that allows me
    handle everything in this method / slot


    i thinked to use a boolean but i should to connect the finish signal of animation with a method

  2. #2
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPropertyAnimation how to lock button slot to avoid reset of animation

    Qt Code:
    1. QPushButton *btn = ....;
    2. connect( btn, SIGNAL(clicked), this, SLOT(on_btn_slot()) );
    To copy to clipboard, switch view to plain text mode 

    To disable use disconnect( btn, 0, 0, 0 ), and connect( btn, SIGNAL(clicked), this, SLOT(on_btn_slot()) ); to connect again. No?

  3. #3
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QPropertyAnimation how to lock button slot to avoid reset of animation

    @up: crappy solution.

    The bast way is to use state machine. Then switching state will start animation. See QStateMachine documentation.

    Another solution is disable button and then enable it again when animation is ended.

Similar Threads

  1. QPropertyAnimation show the Widget before start the animation
    By rperezalejo in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2011, 02:26
  2. QPropertyAnimation and animation speed
    By themk in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2010, 00:05
  3. Replies: 0
    Last Post: 8th April 2010, 09:13
  4. Replies: 1
    Last Post: 9th February 2010, 12:11
  5. How to avoid keyboard-button-toggling ?
    By Comer352l in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2008, 11:02

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.