【问题标题】:Remove selection around QPushButton text删除 QPushButton 文本周围的选择
【发布时间】:2014-11-19 21:42:10
【问题描述】:

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

谢谢!

【问题讨论】:

    标签: css qt button stylesheet


    【解决方案1】:

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

    试一试,然后回来反馈。

    【讨论】: