How to style QPushButton's checked state to remove grey dots?

后端 未结 1 1966
再見小時候
再見小時候 2021-01-12 12:29

I am using Qt 5.3.0. When I apply some background-color on the QPushButton\'s checked state, the button will be filled with grey dots (over the background color I wanted) wh

相关标签:
1条回答
  • 2021-01-12 13:00

    I'm able to remove the dots by simply set border: none; on the QPushButton:checked property of stylesheet.

    On your example, it should be like this:

    w.setStyleSheet("\
                    QPushButton {   \
                        color:white;    \
                    }   \
                    QPushButton:checked{\
                        background-color: rgb(80, 80, 80);\
                        border: none; \
                    }\
                    QPushButton:hover{  \
                        background-color: grey; \
                        border-style: outset;  \
                    }  \
                    ");
    

    And here you can see the result when the button is checked:

    enter image description here

    0 讨论(0)
提交回复
热议问题