summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-03-08 14:06:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-12 09:16:42 +0100
commitda672eba998eb909b6ea264c71f75b4d611101e0 (patch)
tree9bb0e740e87510a5ce1f76ac54d3d1f413061dbd /src/plugins
parent268972999a46822b7de6facc4f36d44dff93e6b0 (diff)
Windows: Use arrow cursor for toplevels with no cursor set.
Fixes unsetting the cursor in Qt Quick Controls. Task-number: QTBUG-28879 Change-Id: I049beafaa723f6e782df872f14c09b7f927e70ac Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 2d0f537477..2da0af8abb 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1705,6 +1705,16 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
}
#endif // !Q_OS_WINCE
+// Return the default cursor (Arrow) from QWindowsCursor's cache.
+static inline QWindowsWindowCursor defaultCursor(const QWindow *w)
+{
+ if (QScreen *screen = w->screen())
+ if (const QPlatformScreen *platformScreen = screen->handle())
+ if (QPlatformCursor *cursor = platformScreen->cursor())
+ return static_cast<QWindowsCursor *>(cursor)->standardWindowCursor(Qt::ArrowCursor);
+ return QWindowsWindowCursor(Qt::ArrowCursor);
+}
+
/*!
\brief Applies to cursor property set on the window to the global cursor.
@@ -1714,9 +1724,12 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
void QWindowsWindow::applyCursor()
{
#ifndef QT_NO_CURSOR
- if (m_cursor.isNull()) { // Recurse up to parent with non-null cursor.
- if (const QWindow *p = window()->parent())
+ if (m_cursor.isNull()) { // Recurse up to parent with non-null cursor. Set default for toplevel.
+ if (const QWindow *p = window()->parent()) {
QWindowsWindow::baseWindowOf(p)->applyCursor();
+ } else {
+ SetCursor(defaultCursor(window()).handle());
+ }
} else {
SetCursor(m_cursor.handle());
}