summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2018-09-18 15:55:08 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2018-09-19 07:53:15 +0000
commit68f7bea4d815a838864028d0e7b9be6294f88091 (patch)
tree5a4c2ace0d76c1ef51216ab8d2282ab22f4cd509
parentdb2cc087da3453066180b45df03ca36777670d0a (diff)
Ensure selection change is sent at undo/redo
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 <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.cpp8
-rw-r--r--src/Authoring/Client/Code/Core/Doc/Doc.h1
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 <typename TDataType>
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<Q3DStudio::IDocSceneGraph> m_SceneGraph;
Q3DStudio::SSelectedValue m_SelectedValue;
bool m_nudging;
+ bool m_unnotifiedSelectionChange = false;
public:
void OnNewPresentation();