QmlDesigner: Fix override cursor on config dialog close in 3D view

Only restore override cursor on dialog destruction if it was actually
hidden by current dialog.

Fixes: QDS-12300
Change-Id: I8789e060244089c7d83e43926f841012602b27a5
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-04-16 15:47:54 +03:00
parent e55b5d0a0b
commit 8154e4c3d0
4 changed files with 16 additions and 6 deletions

View File

@@ -66,9 +66,11 @@ void CameraSpeedConfiguration::resetDefaults()
void CameraSpeedConfiguration::hideCursor()
{
if (QGuiApplication::overrideCursor())
if (m_cursorHidden)
return;
m_cursorHidden = true;
QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
if (QWindow *w = QGuiApplication::focusWindow())
@@ -77,9 +79,11 @@ void CameraSpeedConfiguration::hideCursor()
void CameraSpeedConfiguration::restoreCursor()
{
if (!QGuiApplication::overrideCursor())
if (!m_cursorHidden)
return;
m_cursorHidden = false;
QGuiApplication::restoreOverrideCursor();
if (QWindow *w = QGuiApplication::focusWindow())
@@ -88,7 +92,7 @@ void CameraSpeedConfiguration::restoreCursor()
void CameraSpeedConfiguration::holdCursorInPlace()
{
if (!QGuiApplication::overrideCursor())
if (!m_cursorHidden)
return;
if (QWindow *w = QGuiApplication::focusWindow())

View File

@@ -71,6 +71,7 @@ private:
double m_multiplier = 0.;
bool m_changes = false;
QPoint m_lastPos;
bool m_cursorHidden = false;
};
} // namespace QmlDesigner

View File

@@ -87,9 +87,11 @@ void SnapConfiguration::resetDefaults()
void SnapConfiguration::hideCursor()
{
if (QGuiApplication::overrideCursor())
if (m_cursorHidden)
return;
m_cursorHidden = true;
QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
if (QWindow *w = QGuiApplication::focusWindow())
@@ -98,9 +100,11 @@ void SnapConfiguration::hideCursor()
void SnapConfiguration::restoreCursor()
{
if (!QGuiApplication::overrideCursor())
if (!m_cursorHidden)
return;
m_cursorHidden = false;
QGuiApplication::restoreOverrideCursor();
if (QWindow *w = QGuiApplication::focusWindow())
@@ -109,7 +113,7 @@ void SnapConfiguration::restoreCursor()
void SnapConfiguration::holdCursorInPlace()
{
if (!QGuiApplication::overrideCursor())
if (!m_cursorHidden)
return;
if (QWindow *w = QGuiApplication::focusWindow())

View File

@@ -103,6 +103,7 @@ private:
double m_scaleInterval = 0.;
bool m_changes = false;
QPoint m_lastPos;
bool m_cursorHidden = false;
};
} // namespace QmlDesigner