Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116674

wrong default button color in inactive dialog on macOS in light mode

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.5.2
    • None
    • macOS

      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)

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes