QT - CSS: decoration on focus

后端 未结 5 505
深忆病人
深忆病人 2020-12-03 14:23

I\'m experimenting a bit with CSS for making a cool user interface for my QT application.

I have this problem: I have a QPushButton and when it is on focus it has a r

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-03 15:18

    One more alternative (works in windows and in ubuntu), for simplicity I use solid colors:
    ui->pushButton->setStyleSheet( "QPushButton { background-color: #0188cc; color: #ffffff; outline: none }" );

    Note "outline: none" property - it removes focus rectangle from the button.

    And one more related tip for checkable buttons: by default checked buttons drawed with dot pattern, not solid color as I expected for
    "QPushButton:checked { background-color: #0188cc; color: #ffffff; }".

    I added "border: none" to the button stylesheet:
    "QPushButton:checked { background-color: #0188cc; color: #ffffff; border: none }",
    and dotted pattern disappeared! Now my checked buttons are clean, as I expected with solid background style.

提交回复
热议问题