Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.2
-
None
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.