Results 1 to 2 of 2

Thread: Background of checked QPushButton with stylesheet

  1. #1
    Join Date
    Oct 2012
    Location
    France
    Posts
    29
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Background of checked QPushButton with stylesheet

    Hello everyone,

    My problem is simple: my checked (not pressed) QPushButton background color (setted with stylesheet) is not displayed as wanted; it looks like a Qt::Dense6Pattern is present.
    I tried to modify the stylesheet with different selectors, but no luck for now.

    Below is the simplest code.

    Qt Code:
    1. int main(int argc, char *argv[]){
    2. QApplication app(argc, argv);
    3. QPushButton b1("Button 1", &win);
    4.  
    5. b1.setCheckable(true);
    6. b1.setChecked(true);
    7. b1.setStyleSheet("QPushButton {background-color: blue;}");
    8.  
    9. win.show();
    10.  
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 


    Does this issue ring a bell ?

    Thanks !

  2. #2
    Join Date
    Oct 2012
    Location
    France
    Posts
    29
    Thanks
    1
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Background of checked QPushButton with stylesheet

    What I had to do is modify the button's border in order to bypassing the default's style.

    Qt Code:
    1. QPushButton:checked {
    2. background-color: blue;
    3. border: none; // or something else
    4. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QPushButton Checked Change
    By nightroad in forum Newbie
    Replies: 23
    Last Post: 21st March 2011, 11:55
  2. How to show QPushButton as flat when it is checked
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 3rd August 2010, 11:07
  3. QPushButton stylesheet problem
    By blukske in forum Qt Programming
    Replies: 10
    Last Post: 24th August 2009, 22:51
  4. QPushButton in QDockWidget loses stylesheet
    By martinb0820 in forum Qt Programming
    Replies: 5
    Last Post: 22nd June 2009, 19:23
  5. Replies: 1
    Last Post: 8th October 2007, 00:02

Tags for this Thread

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.