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

QGuiApplication::palette() returns incorrect values on Windows 11

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.7.0 RC, 6.8.0 FF
    • 6.7.0 Beta1, dev
    • GUI: Look'n'Feel
    • None
    • Windows 11 Pro 23H2 Build 22631.2861 (latest updates as of 06 Jan 24)
      Lenovo ThinkPad E15 Gen2 AMD Ryzen 4700U Laptop
      Visual Studio 2022 17.8.3, MSVC 19.38.33133.0
    • Windows
    • 41854cfaa (dev), 65cd5a06a (6.7)

    Description

      While playing around with Qt 6.7beta1 I figured that both fusion and windows11 styles are currently broken for Light system color mode.

      I am using the following code to set the icon colors on the colorSchemeChanged signal from QStyleHints:
       
      const auto palette = QGuiApplication::palette(); ZFontIconOption::gColorDisabled = palette.color(QPalette::ColorGroup::Disabled, QPalette::ColorRole::ButtonText); ZFontIconOption::gColor = palette.color(QPalette::ColorRole::ButtonText);

      With Qt 6.6.1 I get the following (IMHO correct) values:
       

      Style: "fusion"
      Color scheme: Qt::ColorScheme::Light
      Disabled color: QColor(ARGB 1, 0.470588, 0.470588, 0.470588)
      Normal color: QColor(ARGB 1, 0, 0, 0)
      
      Color scheme: Qt::ColorScheme::Dark
      Disabled color: QColor(ARGB 1, 0.615686, 0.615686, 0.615686)
      Normal color: QColor(ARGB 1, 1, 1, 1)
      

      However, Qt 6.7.0beta1 returns the following values:
       

      Style: "fusion"
      Color scheme: Qt::ColorScheme::Light
      Disabled color: QColor(ARGB 0.894118, 0, 0, 0)
      Normal color: QColor(ARGB 0.894118, 0, 0, 0)
      
      Style: "fusion"
      Color scheme: Qt::ColorScheme::Dark
      Disabled color: QColor(ARGB 1, 0.499992, 0.499992, 0.499992)
      Normal color: QColor(ARGB 1, 1, 1, 1)
      
      Style: "windows11"
      Color scheme: Qt::ColorScheme::Dark
      Disabled color: QColor(ARGB 1, 0.499992, 0.499992, 0.499992)
      Normal color: QColor(ARGB 1, 1, 1, 1)
      
      Style: "windows11"
      Color scheme: Qt::ColorScheme::Light
      Disabled color: QColor(ARGB 0.894118, 0, 0, 0)
      Normal color: QColor(ARGB 0.894118, 0, 0, 0)
      

      Note that the Disabled color in the Light mode in both styles is identical to the Normal color, therefore disabled icons will be shown (incorrectly) the same when using Qt 6.7 both with fusion and windows11 style.

      I tested with qt6-dev from the online installer as well and get the same incorrect behaviour.

      I have attached a small testcase which will show "INCORRECT VALUES" iin Light mode on my windows machine with 6.7+ as well with images that visualize the different behvaviour.

      The testcase works without problems with Qt 6.6.1

      Attachments

        1. qt_6_6_1_correct.png
          qt_6_6_1_correct.png
          24 kB
        2. qt_6_7_plus_incorrect.png
          qt_6_7_plus_incorrect.png
          24 kB
        3. qt6.4.2.png
          qt6.4.2.png
          10 kB
        4. qt6.7.0.png
          qt6.7.0.png
          10 kB
        5. testcase.zip
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            wladimir.leuschner Wladimir Leuschner
            derreisende77 Christian F
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes