summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-11-05 14:06:46 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-12-09 17:43:22 +0100
commitbaed8534bc1dac36a9d0ef4240fc14398076a192 (patch)
tree4f5ddaee3f3af581046d78cb0dabfedef3018ac5 /src/gui
parent5272c35073aefee01751647dfb265aa3abf49823 (diff)
Move the tooltip out of the way of very large mouse cursors
Users that have large mouse pointers configured in their settings can not see tooltips, as they are obscured by the pointer. Native applications on Windows and macOS have the same problem, which includes the tooltips for the minimize/maximize/close controls in the window frame of e.g. Explorer. Introduce QPlatformCursor::size that returns a value that is based on the user's settings, or a default value. We can then use that value to move the tooltip out of the way. On Windows, the calculation of the cursor size is based on experimenting with the settings, which are in logical independent pixels. The placement of the tooltip attempts to keep existing behavior, and to not end up with a tooltip that's very far away from the tip of the arrow even for very large mouse cursors. [ChangeLog][QtWidgets][QToolTip] Make sure that the tooltip is not obscured by very large mouse pointers on Windows and macOS. Change-Id: I8e13b7a166bfe8b59cef4765c950f90fefeaef9d Fixes: QTBUG-79627 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qplatformcursor.cpp8
-rw-r--r--src/gui/kernel/qplatformcursor.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index 49eff2ad23..aabf28a727 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -131,6 +131,14 @@ void QPlatformCursor::setPos(const QPoint &pos)
QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove);
}
+/*!
+ Returns the size of the cursor, in native pixels.
+*/
+QSize QPlatformCursor::size() const
+{
+ return QSize(16, 16);
+}
+
// End of display and pointer event handling code
// Beginning of built-in cursor graphics
// from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp
diff --git a/src/gui/kernel/qplatformcursor.h b/src/gui/kernel/qplatformcursor.h
index f36a73c861..f3871d8780 100644
--- a/src/gui/kernel/qplatformcursor.h
+++ b/src/gui/kernel/qplatformcursor.h
@@ -96,6 +96,7 @@ public:
#endif // QT_NO_CURSOR
virtual QPoint pos() const;
virtual void setPos(const QPoint &pos);
+ virtual QSize size() const;
static Capabilities capabilities() { return m_capabilities; }
static void setCapabilities(Capabilities c) { m_capabilities = c; }