summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaj Grönholm <kaj.gronholm@qt.io>2019-08-27 16:09:26 +0300
committerKaj Grönholm <kaj.gronholm@qt.io>2019-08-28 11:42:52 +0300
commitd24062af3b1a476f786106c3a0defa2d812abfca (patch)
tree628d10078d80b6928db6e1898dc5d83543da50ef
parentad0d99dc5457c728fa45ca3b0c5d945fc3bde03f (diff)
Fix guide selection status
Match to scene object behavior where after delete -> undo restored item is not selected. Task-number: QT3DS-3223 Change-Id: Iedaca14c7df43b0dd44aeefb149a2dd0db56f724 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp8
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp4
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h2
3 files changed, 9 insertions, 5 deletions
diff --git a/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp b/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp
index ef5c385c..320bca23 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp
+++ b/src/Authoring/Qt3DStudio/Render/StudioRenderer.cpp
@@ -1088,18 +1088,20 @@ struct SRendererImpl : public IStudioRenderer,
{
m_MaybeDragStart = false;
m_mouseDown = false;
+ bool guideExists = true;
Qt3DSDMGuideHandle theSelectedGuide;
if (m_PickResult.getType() == StudioPickValueTypes::Guide) {
theSelectedGuide = m_PickResult.getData<Qt3DSDMGuideHandle>();
- m_Translation->CheckGuideInPresentationRect(theSelectedGuide, m_UpdatableEditor);
+ guideExists = m_Translation->CheckGuideInPresentationRect(theSelectedGuide,
+ m_UpdatableEditor);
}
m_UpdatableEditor.CommitEditor();
m_PickResult = SStudioPickValue();
if (m_Translation)
m_Translation->EndDrag();
if (theSelectedGuide.GetHandleValue()) {
- // Get rid of selection if things aren't editable.
- if (m_Doc.GetDocumentReader().AreGuidesEditable())
+ // Get rid of selection if things aren't editable or if guide has been deleted.
+ if (guideExists && m_Doc.GetDocumentReader().AreGuidesEditable())
m_Doc.NotifySelectionChanged(theSelectedGuide);
else
m_Doc.NotifySelectionChanged();
diff --git a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp
index 06d6be76..b53084bc 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp
+++ b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp
@@ -3980,7 +3980,7 @@ void STranslation::PerformGuideDrag(Qt3DSDMGuideHandle inGuide, CPt inPoint,
inEditor.FireImmediateRefresh(qt3dsdm::Qt3DSDMInstanceHandle());
}
-void STranslation::CheckGuideInPresentationRect(Qt3DSDMGuideHandle inGuide,
+bool STranslation::CheckGuideInPresentationRect(Qt3DSDMGuideHandle inGuide,
CUpdateableDocumentEditor &inEditor)
{
qt3dsdm::SGuideInfo theInfo = m_Doc.GetDocumentReader().GetGuideInfo(inGuide);
@@ -4000,6 +4000,8 @@ void STranslation::CheckGuideInPresentationRect(Qt3DSDMGuideHandle inGuide,
if (!inPresentation)
inEditor.EnsureEditor(QObject::tr("Delete Guide"), __FILE__, __LINE__).DeleteGuide(inGuide);
+
+ return inPresentation;
}
void STranslation::PerformPathDrag(qt3ds::studio::SPathPick &inPathPick, CPt inOriginalCoords,
diff --git a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h
index 8f38d8e0..66ae9fcc 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h
+++ b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h
@@ -632,7 +632,7 @@ namespace studio {
void PerformGuideDrag(Qt3DSDMGuideHandle inGuide, CPt inPoint,
CUpdateableDocumentEditor &inEditor);
- void CheckGuideInPresentationRect(Qt3DSDMGuideHandle inGuide,
+ bool CheckGuideInPresentationRect(Qt3DSDMGuideHandle inGuide,
CUpdateableDocumentEditor &inEditor);
void PerformPathDrag(qt3ds::studio::SPathPick &inPathPick, CPt inOriginalCoords,