Search code examples
cssqtbuttonstylesheet

Remove selection around QPushButton text


When i add QPushButton on my form, i get this:

enter image description here

You can see ugly text selection (into the button). How can i remove it?
Here is my CSS of this button:

    enterButton->setStyleSheet("QPushButton { \
                                    padding: 6px; \
                                    background: #369; \
                                    color: white; \
                                    font-size: 13px;\
                                    border: 0; \
                                    border-radius: 3px; \
                                }\
                                QPushButton:hover { \
                                    background: #47a; \
                                }\
                                QPushButton:pressed { \
                                    background: #58b; \
                                }");

Thanks!


Solution

  • I don't have Ubuntu installed right now but I think outline: 0px should work:

    enterButton->setStyleSheet("QPushButton { \
                                    padding: 6px; \
                                    background: #369; \
                                    color: white; \
                                    font-size: 13px;\
                                    border: 0; \
                                    border-radius: 3px; \
                                    outline: 0px; \
                                }\
                                QPushButton:hover { \
                                    background: #47a; \
                                }\
                                QPushButton:pressed { \
                                    background: #58b; \
                                }");
    

    Try it and come back with a feedback.