diff options
author | Kaj Grönholm <kaj.gronholm@qt.io> | 2018-05-24 09:15:25 +0300 |
---|---|---|
committer | Kaj Grönholm <kaj.gronholm@qt.io> | 2018-05-25 08:35:18 +0000 |
commit | 8eee0f0d15aa1afc926734c458829e13d36c8c6f (patch) | |
tree | df75ef1f12aefb2510d3716099a7cd6d42ea6b9f | |
parent | 37488058df67e3a2a041746a823c96a295e62a78 (diff) |
Keep ruler duration up-to-date
When user adjusts timebar time, make sure ruler duration is also
updated so e.g. scrollbar appears as needed.
Task-number: QT3DS-1786
Change-Id: I3b9a621920bd77b652ca76eda458e8ae335620a8
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
3 files changed, 11 insertions, 3 deletions
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.cpp index 0075cbc1..a6a06521 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.cpp @@ -27,6 +27,8 @@ ****************************************************************************/ #include "TimelineControl.h" +#include "TimelineGraphicsScene.h" +#include "RowManager.h" #include "RowTree.h" #include "Bindings/ITimelineItemBinding.h" #include "DurationEditDlg.h" @@ -34,7 +36,8 @@ #include "Core.h" #include "Doc.h" -TimelineControl::TimelineControl() +TimelineControl::TimelineControl(TimelineGraphicsScene *scene) + : m_scene(scene) { } @@ -63,6 +66,7 @@ void TimelineControl::ChangeEndTime(long inTime) { double time = (double)inTime / 1000; m_rowTimeline->setEndTime(time); + m_scene->rowManager()->updateRulerDuration(); } void TimelineControl::Commit() @@ -78,4 +82,5 @@ void TimelineControl::Rollback() { m_rowTimeline->setStartTime(m_startTime); m_rowTimeline->setEndTime(m_endTime); + m_scene->rowManager()->updateRulerDuration(); } diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.h index f4ed43f6..981b6db7 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.h +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineControl.h @@ -33,10 +33,12 @@ #include "RowTimeline.h" #include "Bindings/ITimelineTimebar.h" +class TimelineGraphicsScene; + class TimelineControl : public ITimeChangeCallback { public: - TimelineControl(); + TimelineControl(TimelineGraphicsScene *scene); void setRowTimeline(RowTimeline *rowTimeline); void showDurationEditDialog(); @@ -48,6 +50,7 @@ public: void Rollback() override; private: + TimelineGraphicsScene *m_scene = nullptr; RowTimeline *m_rowTimeline = nullptr; ITimelineTimebar *m_timebar = nullptr; double m_startTime = 0; diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp index 7bd01ff6..0203b572 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp @@ -80,7 +80,7 @@ TimelineGraphicsScene::TimelineGraphicsScene(TimelineWidget *timelineWidget) , m_widgetRoot(new QGraphicsWidget) , m_rowManager(new RowManager(this, m_layoutTree, m_layoutTimeline)) , m_keyframeManager(new KeyframeManager(this)) - , m_timelineControl(new TimelineControl) + , m_timelineControl(new TimelineControl(this)) , m_currentCursor(-1) { addItem(m_playHead); |