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
    • 92f6d22db (dev), 0ad15c410 (dev), 68014817a (6.7), 13aac24fb (6.7), a19243211 (tqtc/lts-6.5), 129393ab5 (tqtc/lts-6.5)

    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
          Luqiao Chen
        2. invisible_text.png
          320 kB
          Luqiao Chen
        3. Screenshot 2024-05-07 at 10.18.51.png
          40 kB
          Nils Jeisecke
        4. untitled9.tgz
          4 kB
          Nils Jeisecke

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: