Results 1 to 10 of 10

Thread: QPushButton when disabled becomes grayed out

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    55
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton when disabled becomes grayed out

    I solved it using stylesheet. When I disable button I repeat this command: button->setStyleSheet("background-image: url(path_to_image);");

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QPushButton when disabled becomes grayed out

    Aside from the mechanics of how you get this to work, why would you want to show a button as enabled when it isn't? There's a reason why there are various states for UI controls (enabled, disabled, selected, etc.) - it is to give users a visual clue about what they can (or can't) do at a given point, or what will happen by default (the selected button will be "clicked" if you press Enter on a dialog).

    Why would you want to implement a GUI that is deliberately confusing to users? I can see someone repeatedly clicking on this button, and getting angrier each time because nothing happens.

  3. #3
    Join Date
    Aug 2012
    Posts
    55
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPushButton when disabled becomes grayed out

    Because I'm using my own icon to show that button is disabled. I only need to put big X on top of my button and that will indicate it is disabled (I'm making a game)

  4. The following user says thank you to alenn.masic for this useful post:

    d_stranz (19th February 2013)

  5. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QPushButton when disabled becomes grayed out

    OK, that makes sense. As long as you show the user somehow that "You can't press this button now", then that is consistent with what the user expects.

Similar Threads

  1. Replies: 0
    Last Post: 21st February 2012, 02:45
  2. Scrollbar always grayed out
    By Gargolissimus in forum Newbie
    Replies: 5
    Last Post: 6th July 2009, 20:22
  3. QPushbutton with background image when disabled
    By soumyadeep_pan in forum Qt Programming
    Replies: 1
    Last Post: 29th May 2009, 15:50
  4. QPushButton grayed out
    By stefan1981 in forum Qt Programming
    Replies: 2
    Last Post: 9th January 2009, 14:27

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.