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

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

    XMLWordPrintable

Details

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

    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)

      Attachments

        1. Screenshot 2023-09-01 at 15.40.55.png
          108 kB
          Vladimir Kraus
        2. image-2023-09-01-15-47-05-386.png
          82 kB
          Vladimir Kraus
        3. image-2023-09-01-15-48-11-531.png
          73 kB
          Vladimir Kraus
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            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

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes