Windows QPA: Fix handling of override cursors
Override cursors were not restored when nested or in a dual monitor setups. The default cursor stored in QWindowsCursor::m_overriddenCursor was clobbered by subsequent calls to QWindowsCursor::setOverrideCursor(). This caused for example the wait cursor to remain active when switching to Help Mode in Qt Creator. Add a check preventing that. Make the variable static so that it is shared between the cursors of multiple screens. Amends b05d1c2ebfebf0f427a92668c0a7b177d0952012. Task-number: QTBUG-65001 Change-Id: Iead5804d317f73dedd78d22c1c85c62b5349ab83 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
e55c7974db
commit
141bca90e1
@ -548,6 +548,8 @@ CursorHandlePtr QWindowsCursor::standardWindowCursor(Qt::CursorShape shape)
|
||||
return it != m_standardCursorCache.end() ? it.value() : CursorHandlePtr(new CursorHandle);
|
||||
}
|
||||
|
||||
HCURSOR QWindowsCursor::m_overriddenCursor = nullptr;
|
||||
|
||||
/*!
|
||||
\brief Return cached pixmap cursor or create new one.
|
||||
*/
|
||||
@ -623,7 +625,9 @@ void QWindowsCursor::setOverrideCursor(const QCursor &cursor)
|
||||
{
|
||||
const CursorHandlePtr wcursor = cursorHandle(cursor);
|
||||
if (wcursor->handle()) {
|
||||
m_overriddenCursor = SetCursor(wcursor->handle());
|
||||
const HCURSOR previousCursor = SetCursor(wcursor->handle());
|
||||
if (m_overriddenCursor == nullptr)
|
||||
m_overriddenCursor = previousCursor;
|
||||
} else {
|
||||
qWarning("%s: Unable to obtain system cursor for %d",
|
||||
__FUNCTION__, cursor.shape());
|
||||
|
@ -141,7 +141,7 @@ private:
|
||||
mutable QPixmap m_linkDragCursor;
|
||||
mutable QPixmap m_ignoreDragCursor;
|
||||
|
||||
HCURSOR m_overriddenCursor = nullptr;
|
||||
static HCURSOR m_overriddenCursor;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user