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

Dark mode aware palette prevents QToolTip stylesheet styling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.2
    • GUI: Look'n'Feel
    • None
    • Windows

    Description

      In Qt 5.15.2 it was possible to style a QToolTip using the following stylesheet:

      QToolTip {
          border: 1px solid black;
          background-color: yellow;
          color: red;
      };
      

      In Qt 6.5.2 this does not work anymore, because the stylesheet text color is ignored and the system text color is used, that comes from the system style (dark or light). I modified the calculatorform example, to show this problem (see attachment to reproduce the issue)

      windows_light_mode.png shows a screenshot of the application started when Windows 11 is in light mode. The stylesheet text color is ignored and the system color is used.

      windows_dark_mode.png shows a screenshot of the application started when Windows 11 is in dark mode. The stylesheet text color is ignored and the light system text color is used which leads to an unreadable tooltip.

      windows_dark_mode_reload.png shows the same as windows_dark_mode.png but the stylesheet has been reloaded after the QToolTip palette has been set to an empty palette - now the red text color from the stylesheet is properly applied.

      QToolTip::setPalette(QPalette()); // workaround to set QToolTip color via stylesheet
      

      I think this bug is related to my reported bug QTBUG-122780 and to this topic:

      https://www.qt.io/blog/dark-mode-on-windows-11-with-qt-6.5

      Somehow the system style aware palette causes some styling issues.

      Attachments

        1. calculatorform.zip
          6 kB
          Uwe Kindler
        2. windows_dark_mode_reload.png
          5 kB
          Uwe Kindler
        3. windows_dark_mode.png
          5 kB
          Uwe Kindler
        4. windows_light_mode.png
          6 kB
          Uwe Kindler
        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
            ukindler Uwe Kindler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes