diff options
author | Liang Qi <liang.qi@qt.io> | 2018-08-07 18:12:02 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-08-07 18:12:02 +0000 |
commit | ee2e38490d51667e878ed1732df387a6d9f2a5fe (patch) | |
tree | 4f3b02ab7220326d918b199d60fb33fc497d6dac /src/plugins/platforms/windows/qwindowscursor.cpp | |
parent | 491e427bb2d3cafccbb26d2ca3b7e128d786a564 (diff) | |
parent | 053e7cce79d4bef99ec85101b0d22bbb171072c5 (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscursor.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscursor.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index 1443e5e920..825602e7dc 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -550,6 +550,7 @@ CursorHandlePtr QWindowsCursor::standardWindowCursor(Qt::CursorShape shape) } HCURSOR QWindowsCursor::m_overriddenCursor = nullptr; +HCURSOR QWindowsCursor::m_overrideCursor = nullptr; /*! \brief Return cached pixmap cursor or create new one. @@ -622,11 +623,20 @@ void QWindowsCursor::changeCursor(QCursor *cursorIn, QWindow *window) } } +// QTBUG-69637: Override cursors can get reset externally when moving across +// window borders. Enforce the cursor again (to be called from enter event). +void QWindowsCursor::enforceOverrideCursor() +{ + if (hasOverrideCursor() && m_overrideCursor != GetCursor()) + SetCursor(m_overrideCursor); +} + void QWindowsCursor::setOverrideCursor(const QCursor &cursor) { const CursorHandlePtr wcursor = cursorHandle(cursor); - if (wcursor->handle()) { - const HCURSOR previousCursor = SetCursor(wcursor->handle()); + if (const auto overrideCursor = wcursor->handle()) { + m_overrideCursor = overrideCursor; + const HCURSOR previousCursor = SetCursor(overrideCursor); if (m_overriddenCursor == nullptr) m_overriddenCursor = previousCursor; } else { @@ -639,7 +649,7 @@ void QWindowsCursor::clearOverrideCursor() { if (m_overriddenCursor) { SetCursor(m_overriddenCursor); - m_overriddenCursor = nullptr; + m_overriddenCursor = m_overrideCursor = nullptr; } } |