Results 1 to 9 of 9

Thread: How to prohibit click to button

  1. #1
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default How to prohibit click to button

    I have QGroupButtons of 5 buttons, and I want that all of them will be disabled without color changing..
    setDisable() is suitable, but this changing color..

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: How to prohibit click to button

    You can disconnect the clicked signal.

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

    somename (27th May 2010)

  4. #3
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: How to prohibit click to button

    No, any othter idea.
    what I must to do that button.setEnable(true) and button.setEnabled(false) have same view?
    Last edited by somename; 27th May 2010 at 22:59.

  5. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to prohibit click to button

    Quote Originally Posted by somename View Post
    No, any othter idea.
    Why not?
    what I must to do that setEnable(true) and setEnabled(false) have same view?
    Well it is the idea that it is displayed differently. So this is the wrong way to go!
    Stick with the signals as Zlatomir said. You also can use QObject::blockSignals() which could be more easier to use.

  6. The following 2 users say thank you to Lykurg for this useful post:

    somename (27th May 2010), Zlatomir (27th May 2010)

  7. #5
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to prohibit click to button

    You can take over the drawing of the button, but what you are trying to do is directly against the user interface guidelines.

    Is there a reason you don't want to inform the user the button isn't clickable?

  8. The following 2 users say thank you to squidge for this useful post:

    somename (27th May 2010), Zlatomir (27th May 2010)

  9. #6
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: How to prohibit click to button

    It is too hard to explain, because my English is bad.
    Ok, i will try.

    I have 5 buttons, after clicked on one of them sound start playing, and while sound are playing, user can select any of 5 buttons, and i don't want this (yeah, I can do BlockSignal, but I always can select any other button).
    If after cliked i do "setDisabled(true) " for all 5 buttons, there is some unlikely view when all buttons are Disabled

  10. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to prohibit click to button

    I don't see the difference between:
    1) All the buttons are disabled
    2) The buttons look enabled, but are not clickable

    In fact, I'd say (2) would be more confusing.

    Maybe a better way would be: Whilst sound is playing, you show another modal window saying "Playing sound" or whatever. Due to the fact the window is modal, it blocks all mouse clicks to your other window with the 5 buttons in. Therefore the 5 buttons look enabled, but no one can click on them, and they get visual feedback why they can't click on them. When sound is finished, you destroy the window, therefore you can click on buttons again.

  11. The following user says thank you to squidge for this useful post:

    Zlatomir (27th May 2010)

  12. #8
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: How to prohibit click to button

    the difference between this:
    when all the buttons are disabled, I can't select any button, but when all buttons are enabled, but not clickable, I can do this thing:
    some.pngi.e. I can checked some other button, but I don't want this

  13. #9
    Join Date
    May 2010
    Posts
    39
    Thanks
    11
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: How to prohibit click to button

    I have forgotten to say you, that my button is checkable

Similar Threads

  1. Simulating a Button Click signal
    By Ratheendrans in forum Qt Programming
    Replies: 4
    Last Post: 5th May 2010, 12:57
  2. How can I know which button click.
    By electronicboy in forum Qt Programming
    Replies: 10
    Last Post: 4th October 2009, 15:27
  3. button click in webview
    By mind_freak in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2009, 14:48
  4. Some errors if I don't click on QMessageBox button
    By jiveaxe in forum Qt Programming
    Replies: 7
    Last Post: 23rd January 2008, 16:20
  5. QPaintEvent on button click?
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2007, 09:44

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.