summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-01-05 16:01:35 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-01-07 04:57:32 +0100
commiteac9e74d9271f793f2a49af6ba776dd444875844 (patch)
tree6cd6ad39a7864f18b5cf41cbf9fb2afdd53bfe60 /src/plugins/platforms
parentc630b231ecd674b80a554bf40b37086b64c73f6a (diff)
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 <santhosh.kumar.selvaraj@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp13
1 files changed, 6 insertions, 7 deletions
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);