Results 1 to 3 of 3

Thread: QPushButton::setDown() doesn't stay down

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QPushButton::setDown() doesn't stay down

    Hello.

    Sometimes I would like to programmatically set a button down and keep it in a pushed state. This has no other than visual reasons, it shows that there is a process running that can be stopped by the same button that started it.

    I just discovered that it actually doesn't work.

    Qt Code:
    1. void MyWidget::on_Button_clicked()
    2. {
    3. if (ui.Button->isDown())
    4. return;
    5.  
    6. ui.Button->setDown(true);
    7. }
    To copy to clipboard, switch view to plain text mode 

    After I click the button, it stays down like it should. But when the button loses focus, it comes back up. Another thing is that despite the check if the button is down already, wild clicking can also bring it back up again. Is there anything I can do about this? I know I could disable a button instead of downing it, but I'm already using that for when a button should be really disabled.

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton::setDown() doesn't stay down

    would setCheckable() work for you..it will make the button toggle..so when u click, it'll stay in down state until u click it again or emit clicked() urself

  3. The following 2 users say thank you to talk2amulya for this useful post:

    Cruz (24th February 2009), Naytheet (18th January 2013)

  4. #3
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton::setDown() doesn't stay down

    Thanks mate! It works totally awesome.

Similar Threads

  1. stay selected while children are moved?
    By mooreaa in forum Qt Programming
    Replies: 0
    Last Post: 13th July 2008, 04:25
  2. QScrollArea stay down
    By bunjee in forum Qt Programming
    Replies: 2
    Last Post: 3rd June 2008, 11:14
  3. Replies: 4
    Last Post: 4th June 2007, 12:07
  4. is it possible to stay on a user defined infinite loop?
    By mahe2310 in forum Qt Programming
    Replies: 9
    Last Post: 24th March 2006, 14:29

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.