当前位置: 代码迷 >> QT开发 >> PushButton获取焦点后出现难看的线框解决思路
  详细解决方案

PushButton获取焦点后出现难看的线框解决思路

热度:82   发布时间:2016-04-25 03:45:34.0
PushButton获取焦点后出现难看的线框
本人设置了在QSS这样设置PushButton,可是在QT程序让按钮聚焦的时候,出现了如下图片的状况,有点不太好像,请问有办法补救的办法?谢谢!

 QPushButton {
     border: 2px solid #8f8f91;
     border-radius: 6px;
     background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                       stop: 0 #f6f7fa, stop: 1 #dadbde);
     min-width: 80px;
 }

 QPushButton:pressed {
     background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                       stop: 0 #dadbde, stop: 1 #f6f7fa);
 }

 QPushButton:flat {
     border: none; /* no border for a flat push button */
 }

 QPushButton:default {
     border-color: navy; /* make the default button prominent */
 }


Qt PushButton 聚焦? setFocus? 线框

------解决方案--------------------
ui->pushButton->setFocusPolicy(Qt::NoFocus);
------解决方案--------------------

我这是正常的
------解决方案--------------------
你那颜色看着不对,还有其他地方设置样式表了吗
------解决方案--------------------
引用:
Quote: 引用: