diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-05-31 18:05:43 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-06-01 04:12:35 +0000 |
commit | 4dbd48a69438cee52138e64a57f660275c341585 (patch) | |
tree | 9f6d64c4f97a1f163a0c07f6d214788f17a004e2 | |
parent | 828c18fbe3b29d7e3571037f678ec43dd0ae1cba (diff) |
Fix slides getting stuck on master slide
Updating the return slide when the slide change was caused by the
engine rather than user would update the return slide to the master
slide itself. Changed it so that the return slide is updated every
time we change to non-master slide.
Task-number: QT3DS-1750
Change-Id: I105d2996265cc152782f8b1ec9fb9a5f02adf4b3
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.cpp | 22 | ||||
-rw-r--r-- | src/Authoring/Studio/Palettes/Slide/SlideView.h | 5 |
2 files changed, 11 insertions, 16 deletions
diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp index bfcb2505..6f82ef9b 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.cpp +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.cpp @@ -93,24 +93,18 @@ void SlideView::setShowMasterSlide(bool show) theBridge->GetOrCreateGraphRoot(theRoot); // this will return the master slide qt3dsdm::ISlideSystem *theSlideSystem = theDoc->GetStudioSystem()->GetSlideSystem(); if (m_CurrentModel != m_MasterSlideModel) { - const auto theFind = m_MasterSlideReturnPointers.find(theNewActiveSlide); - size_t theSlideIndex = 1; - size_t theNumSlides = theSlideSystem->GetSlideCount(theNewActiveSlide); - if (theFind != m_MasterSlideReturnPointers.end() && theFind->second < theNumSlides) - theSlideIndex = theFind->second; - - theNewActiveSlide = theSlideSystem->GetSlideByIndex( - theNewActiveSlide, theSlideIndex); // activate the first slide - } else { - int theIndex = theSlideSystem->GetActiveSlideIndex(theNewActiveSlide); - m_MasterSlideReturnPointers[theNewActiveSlide] = theIndex; + if (m_MasterSlideReturnPointers.contains(theNewActiveSlide)) { + theNewActiveSlide = m_MasterSlideReturnPointers.value(theNewActiveSlide); + } else { + theNewActiveSlide = theSlideSystem->GetSlideByIndex( + theNewActiveSlide, 1); // activate the first slide; + } } // We have forced a mode change, and so we need to set the current active TC // to be in the correct mode so our slide palette will show the correct information - if (theNewActiveSlide.Valid()) { + if (theNewActiveSlide.Valid()) theDoc->NotifyActiveSlideChanged(theNewActiveSlide); - } Q_EMIT showMasterSlideChanged(); Q_EMIT currentModelChanged(); @@ -250,6 +244,8 @@ void SlideView::OnActiveSlide(const qt3dsdm::Qt3DSDMSlideHandle &inMaster, int i auto index = m_SlidesModel->index(currentSlideIndex - 1, 0); m_SlidesModel->setSelectedSlideIndex(index); + if (currentSlideIndex != 0) + m_MasterSlideReturnPointers[inMaster] = inSlide; } void SlideView::OnNewSlide(const qt3dsdm::Qt3DSDMSlideHandle &inSlide) diff --git a/src/Authoring/Studio/Palettes/Slide/SlideView.h b/src/Authoring/Studio/Palettes/Slide/SlideView.h index a1d410e1..4bf5f14f 100644 --- a/src/Authoring/Studio/Palettes/Slide/SlideView.h +++ b/src/Authoring/Studio/Palettes/Slide/SlideView.h @@ -29,7 +29,7 @@ #ifndef SLIDEVIEW_H #define SLIDEVIEW_H -#include <QQuickWidget> +#include <QtQuickWidgets/qquickwidget.h> #include "DispatchListeners.h" #include "SlideModel.h" @@ -38,7 +38,6 @@ #include "Qt3DSDMSignals.h" #include "DispatchListeners.h" #include "Dispatch.h" -#include <unordered_map> class CClientDataModelBridge; class CDoc; @@ -127,7 +126,7 @@ private: QColor m_BaseColor = QColor::fromRgb(75, 75, 75); std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> m_Connections; /// connections to the DataModel - typedef std::unordered_map<int, int> TIntIntMap; + typedef QHash<int, int> TIntIntMap; // We need to remember which slide we were on when we entered the master slide. // Then, when the users leave the master slide we can go back to roughly the same // state. |