From da672eba998eb909b6ea264c71f75b4d611101e0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 8 Mar 2013 14:06:32 +0100 Subject: Windows: Use arrow cursor for toplevels with no cursor set. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes unsetting the cursor in Qt Quick Controls. Task-number: QTBUG-28879 Change-Id: I049beafaa723f6e782df872f14c09b7f927e70ac Reviewed-by: Jan Arve Sæther Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/plugins') 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(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()); } -- cgit v1.2.3