删除QPushButton文本周围的选择

Efo*_*fog 4 css qt button stylesheet

当我在表单上添加QPushButton时,我得到了这个:

在此输入图像描述

你可以看到丑陋的文字选择(进入按钮).我怎么能删除它?
这是我的这个按钮的CSS:

    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; \
                                }");
Run Code Online (Sandbox Code Playgroud)

谢谢!

Iul*_*liu 6

我现在没有Ubuntu安装,但我认为outline: 0px应该工作:

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; \
                            }");
Run Code Online (Sandbox Code Playgroud)

尝试一下,然后回复一下.

  • QPushButton:focus {border:none; 大纲:无; } http://www.qtcentre.org/threads/27656-Can-I-remove-hide-the-border-when-QPushButton-is-highlighted-focus-active (3认同)