Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.5.2
-
None
Description
In the following code, I display a main window, and then a dialog box over it. The dialog box has flag Tool in order to stay in front of the main window. When the dialog gets inactivated, the text in the default button disappears. This is a regression bug because in older version, the button was rendered correctly. It affect only rendering in light mode, dark mode is fine. Note that the problem on ly when the dialog is inactive, i.e. the focus is back in the main window. When the focus is in the dialog, then the button is rendered correctly with the correct accent color in all cases.
#include <QApplication> #include <QDialog> #include <QDialogButtonBox> #include <QTimer> #include <QVBoxLayout> #include <QWidget> class Dialog : public QDialog { public: explicit Dialog(QWidget *parent = nullptr) : QDialog(parent) { setWindowFlags( windowFlags() | Qt::Tool ); auto btnBox = new QDialogButtonBox(); btnBox->addButton("Ok", QDialogButtonBox::AcceptRole); btnBox->addButton("Cancel", QDialogButtonBox::RejectRole); auto vbox = new QVBoxLayout(this); vbox->addWidget(btnBox); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; w.show(); QTimer::singleShot(1000, &w, [&w] { auto dlg = new Dialog(&w); dlg->show(); w.activateWindow(); }); return a.exec(); }
This is the screenshot with Qt5 (which is fine)
And this is in Qt 6 (which is wrong)
This is in Qt6 in dark mode (which is also correct)