Qt的一些控件(QPushButton,QCheckBox,QRadioButton等等)通过点击鼠标或切换方向键获得的焦点后会出现边框线,非常影响美观,本文通过设置样式表去除边框线。
QPushButton:focus {
margin: 0px;
outline: none;
}
QPushButton *button = new QPushButton(QStringLiteral("Hello world!"));
button->setStyleSheet(R"(
QPushButton:focus {
margin: 0px;
outline: none;
})");