From 68f7bea4d815a838864028d0e7b9be6294f88091 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 18 Sep 2018 15:55:08 +0300 Subject: Ensure selection change is sent at undo/redo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Undo/redo temporarily clears selection without notifying anyone, and then sets the correct selection after operation is done. However, if the correct selection after the undo/redo operation was nothing, then the selection clear was never notified in account of selection not changing, leaving document and palettes in inconsistent selection state. Task-number: QT3DS-2359 Change-Id: Ifff25c54d72a0227e3370569f56989be9d64f299 Reviewed-by: Mahmoud Badri Reviewed-by: Tomi Korpipää --- src/Authoring/Client/Code/Core/Doc/Doc.cpp | 8 +++++--- src/Authoring/Client/Code/Core/Doc/Doc.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp index 91d79ee0..a0ff63e0 100644 --- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp +++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp @@ -795,7 +795,7 @@ void CDoc::DeselectAllItems(bool inSendEvent) if (inSendEvent) NotifySelectionChanged(); else - SetSelection(); + m_unnotifiedSelectionChange = SetSelection(); // Remove selection on keyframes. DeselectAllKeyframes(); @@ -1084,9 +1084,11 @@ bool CDoc::SetSelection(Q3DStudio::SSelectedValue inNewSelection) void CDoc::NotifySelectionChanged(Q3DStudio::SSelectedValue inNewSelection) { m_SelectedValue = inNewSelection; - if (SetSelection(inNewSelection)) { + if (SetSelection(inNewSelection)) m_Core->GetDispatch()->FireSelectionChange(inNewSelection); - } + else if (m_unnotifiedSelectionChange) + m_Core->GetDispatch()->FireSelectionChange(m_SelectedObject); + m_unnotifiedSelectionChange = false; } template diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.h b/src/Authoring/Client/Code/Core/Doc/Doc.h index fc27fdec..43c4743b 100644 --- a/src/Authoring/Client/Code/Core/Doc/Doc.h +++ b/src/Authoring/Client/Code/Core/Doc/Doc.h @@ -503,6 +503,7 @@ protected: std::shared_ptr m_SceneGraph; Q3DStudio::SSelectedValue m_SelectedValue; bool m_nudging; + bool m_unnotifiedSelectionChange = false; public: void OnNewPresentation(); -- cgit v1.2.3