Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.2, 6.3.1
-
None
Description
I'm seeing weird effects of
QPushButton:default {border: ...}
As well as weird interaction of the 'border' property with 'padding'.
Here's what the problem looks like:
As you can see, the default button highlight border is clipping the text. And padding seems to have a weird reverse effect on the dotted input focus frame - the frame seems to shrink as you increase padding.
Here's the repro. The commented out part tests buttons outside of a message box, which shows the weird sizing of the dotted focus frame as well, but there is no text clipping. That only happens in a message box.
#include <QApplication> #include <QMessageBox> #include <QPushButton> #include <QVBoxLayout> static const QString style = R"( QPushButton { padding: 4px; } QPushButton:default { border: 2px solid #800000; /*padding: 4px;*/ } )"; static void showMsgBox() { QMessageBox m; m.addButton("Upgrade", QMessageBox::YesRole); m.addButton("QfgqM", QMessageBox::NoRole); m.exec(); } int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyleSheet(style); showMsgBox(); // QWidget w; // auto l = new QVBoxLayout; // auto spacer = new QWidget; // spacer->setFixedSize(200, 50); // l->addWidget(spacer); // auto btn = new QPushButton("Upgrade fgpq"); // l->addWidget(btn); // l->addWidget(new QPushButton("Second fgpq")); // w.setLayout(l); // w.show(); // QObject::connect(btn, &QPushButton::clicked, &showMsgBox); return a.exec(); }