移除QPushButton文本周围的选择效果

5
当我在我的表单上添加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; \
                                }");

谢谢!

1个回答

8

我现在没有安装 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; \
                            }");

试一下,然后提供反馈。



网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接