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

The text of QML ComboBox in a Window turns invisible in dark mode

    XMLWordPrintable

Details

    • macOS

    Description

      Reproducer and a screenshot illustrating the issue are attached.

      In light mode, everything looks fine - the ComboBox has a white background and black text inside. But in dark mode, ComboBox still has white background and text is totally invisible (See screenshot. I assume text becomes white as OS theme changes?).

      I blame the fact that QML Window is not styled. Since with ApplicationWindow, everything looks perfect in both light and dark mode. Specifically, I think the good "updating all its children including popups" practice only exists in ApplicationWindow implementation but not Window implementation:
      https://github.com/qt/qtdeclarative/blob/dev/src/quicktemplates/qquickapplicationwindow.cpp#L132

      import QtQuick
      import QtQuick.Window
      import QtQuick.Controls.macOS
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          ComboBox {
              model: ["ONE", "TWO", "THREE"]
          }
      }
      

      Attachments

        1. ComboBox_issue.zip
          4 kB
        2. invisible_text.png
          invisible_text.png
          320 kB
        3. Screenshot 2024-05-07 at 10.18.51.png
          Screenshot 2024-05-07 at 10.18.51.png
          40 kB
        4. untitled9.tgz
          4 kB

        Issue Links

          For Gerrit Dashboard: QTBUG-124474
          # Subject Branch Project Status CR V

          Activity

            People

              mitch_curtis Mitch Curtis
              luqiaochen Luqiao Chen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews