Results 1 to 2 of 2

Thread: Coloring checkable QPushbutton with style sheet

  1. #1
    Join Date
    Jan 2008
    Posts
    56
    Thanks
    7
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Coloring checkable QPushbutton with style sheet

    Try the following:

    Open the designer, pull a Pushbutton on an empty widget, make it checkable and give it the following style sheet
    Qt Code:
    1. QPushButton {background-color: green;}
    2. QPushButton:checked{background-color: red;}
    To copy to clipboard, switch view to plain text mode 
    This should make the unchecked button green and the checked button red.
    However, what happens is:
    It's green when unchecked
    It's lightgray when checked
    It's red whil you keep it pressed when it is in the checked state.

    What am I missing. The documentation says "Checkable QPushButton have the :checked pseudo state set. "

    I am using XP and Vista (happens in both) and Qt 4.3.2

    Regards,

    Rainer

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Coloring checkable QPushbutton with style sheet

    What happens when you run your application with -style plastique option?

Similar Threads

  1. QToolButton and Style sheet
    By desch in forum Qt Programming
    Replies: 8
    Last Post: 1st December 2007, 09:38
  2. Qt 4.3 Style sheet, new features
    By Angelo Moriconi in forum Qt Programming
    Replies: 2
    Last Post: 12th June 2007, 16:22

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.