summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscursor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscursor.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 0a09b87ba3..e7ba08b719 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -586,6 +586,13 @@ QWindowsCursor::QWindowsCursor(const QPlatformScreen *screen)
Q_UNUSED(dummy)
}
+inline CursorHandlePtr QWindowsCursor::cursorHandle(const QCursor &cursor)
+{
+ return cursor.shape() == Qt::BitmapCursor
+ ? pixmapWindowCursor(cursor)
+ : standardWindowCursor(cursor.shape());
+}
+
/*!
\brief Set a cursor on a window.
@@ -603,9 +610,7 @@ void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window)
platformWindow->setCursor(CursorHandlePtr(new CursorHandle));
return;
}
- const CursorHandlePtr wcursor =
- cursorIn->shape() == Qt::BitmapCursor ?
- pixmapWindowCursor(*cursorIn) : standardWindowCursor(cursorIn->shape());
+ const CursorHandlePtr wcursor = cursorHandle(*cursorIn);
if (wcursor->handle()) {
platformWindow->setCursor(wcursor);
} else {
@@ -614,6 +619,25 @@ void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window)
}
}
+void QWindowsCursor::setOverrideCursor(const QCursor &cursor)
+{
+ const CursorHandlePtr wcursor = cursorHandle(cursor);
+ if (wcursor->handle()) {
+ m_overriddenCursor = SetCursor(wcursor->handle());
+ } else {
+ qWarning("%s: Unable to obtain system cursor for %d",
+ __FUNCTION__, cursor.shape());
+ }
+}
+
+void QWindowsCursor::clearOverrideCursor()
+{
+ if (m_overriddenCursor) {
+ SetCursor(m_overriddenCursor);
+ m_overriddenCursor = nullptr;
+ }
+}
+
QPoint QWindowsCursor::mousePosition()
{
POINT p;