From eac9e74d9271f793f2a49af6ba776dd444875844 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 5 Jan 2023 16:01:35 +0100 Subject: Dark windows: use background/foreground colors for tooltips That follows what File Explorer on Windows 11, or the system UI does for tooltips in modern UI elements (the tooltip for the "minimize" button in a titlebar still shows the yellow-colored tooltip). Using the accent color makes the tooltip pop a lot more, but doesn't look native. Also make the toolTipPalette helper function do something useful in dark mode. Pick-to: 6.5 Change-Id: I2b07abd72eee50508f19f46aaec3408183c27100 Reviewed-by: Santhosh Kumar Reviewed-by: David Schulz --- src/plugins/platforms/windows/qwindowstheme.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index b9d02a4374..6e804c53a0 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -298,8 +298,8 @@ static void populateDarkSystemBasePalette(QPalette &result) result.setColor(QPalette::All, QPalette::Link, linkColor); result.setColor(QPalette::All, QPalette::LinkVisited, accentDarkest); result.setColor(QPalette::All, QPalette::AlternateBase, accentDarkest); - result.setColor(QPalette::All, QPalette::ToolTipBase, accentDarkest); - result.setColor(QPalette::All, QPalette::ToolTipText, accentLightest); + result.setColor(QPalette::All, QPalette::ToolTipBase, buttonColor); + result.setColor(QPalette::All, QPalette::ToolTipText, foreground.darker(120)); result.setColor(QPalette::All, QPalette::PlaceholderText, placeHolderColor(foreground)); } @@ -335,12 +335,11 @@ static QPalette systemPalette(bool light) static inline QPalette toolTipPalette(const QPalette &systemPalette, bool light) { - if (!light) - return systemPalette; - QPalette result(systemPalette); - const QColor tipBgColor = getSysColor(COLOR_INFOBK); - const QColor tipTextColor = getSysColor(COLOR_INFOTEXT); + const QColor tipBgColor = light ? getSysColor(COLOR_INFOBK) + : systemPalette.button().color(); + const QColor tipTextColor = light ? getSysColor(COLOR_INFOTEXT) + : systemPalette.buttonText().color().darker(120); result.setColor(QPalette::All, QPalette::Button, tipBgColor); result.setColor(QPalette::All, QPalette::Window, tipBgColor); -- cgit v1.2.3