summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2022-11-01 14:57:33 +0100
committerLiang Qi <liang.qi@qt.io>2022-11-18 16:19:34 +0100
commita823366f7745c235a752dc01c42276b3fa410937 (patch)
treee7eacb9ec2d37c554f8bd4a2d0ef7c9cf8d0a33a /src/gui/kernel
parentf678893f8acd00bd0caca5101858e2a9fdf96a5c (diff)
Add QPlatformTheme::MouseCursorTheme and MouseCursorSize
Also implement in QGenericUnixTheme/QKdeTheme/QGnomeTheme/QGtk3Theme. On Wayland, there is wl_cursor_theme_load() and etc in wayland-cursor.h. On X11/xcb, cursor theme and size are common, either in XCURSOR_THEME and XCURSOR_SIZE envs, or in gsettings for gtk/gnome world. On Windows, cursor theme is part of theme file, see SetWindowTheme in https://learn.microsoft.com/en-gb/windows/win32/api/uxtheme/nf-uxtheme-setwindowtheme . For system settings, for example on Windows 10, Mouse Settings, Additional mouse options, Pointers Tab, Scheme. On macOS, it looks like cursor theme is deprecated. Change-Id: I5821377d966c281fb8330da1f5baa7f0ddf86a9f Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qplatformtheme.cpp10
-rw-r--r--src/gui/kernel/qplatformtheme.h4
2 files changed, 13 insertions, 1 deletions
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index ec4b9c2b86..cdae746ba1 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -147,6 +147,12 @@ QT_BEGIN_NAMESPACE
input focus after a touch/mouse release.
This enum value has been added in Qt 6.5.
+ \value MouseCursorTheme (QString) Name of the mouse cursor theme.
+ This enum value has been added in Qt 6.5.
+
+ \value MouseCursorSize (QSize) Size of the mouse cursor.
+ This enum value has been added in Qt 6.5.
+
\sa themeHint(), QStyle::pixelMetric()
*/
@@ -627,6 +633,10 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(5000);
case MenuBarFocusOnAltPressRelease:
return false;
+ case MouseCursorTheme:
+ return QVariant(QString());
+ case MouseCursorSize:
+ return QVariant(QSize(16, 16));
}
return QVariant();
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 1b7fc85c81..326b69c1e7 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -92,7 +92,9 @@ public:
FlickStartDistance,
FlickMaximumVelocity,
FlickDeceleration,
- MenuBarFocusOnAltPressRelease
+ MenuBarFocusOnAltPressRelease,
+ MouseCursorTheme,
+ MouseCursorSize
};
Q_ENUM(ThemeHint)