summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
diff options
context:
space:
mode:
authorMahmoud Badri <mahmoud.badri@qt.io>2019-08-30 10:38:06 +0300
committerMahmoud Badri <mahmoud.badri@qt.io>2019-09-02 10:45:49 +0300
commit747f520cc2e16a97d38c3caf28ecb1880ae1aa4c (patch)
tree67ef832b1557e1999fc2e79590bf8ab0189c1d0c /src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
parentcd88fefac16b842d938f154d574330fcc0ed2432 (diff)
Timeline ruler and scaling enhancements
- Make timeline scaling smoother and allow further scale values. - Implement non linear scaling strategy which improve UX. - Double clicking the scale head resets the scale to the default value - Optimize drawing by only drawing the visible part of the ruler. - Other assorted small tweaks Change-Id: I5fbf729f3b5e098a60e26978af6bc82bb5f307ae Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp')
-rw-r--r--src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
index 026a7a68..6aff79cb 100644
--- a/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
+++ b/src/Authoring/Qt3DStudio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -285,7 +285,7 @@ TimelineGraphicsScene::TimelineGraphicsScene(TimelineWidget *timelineWidget)
});
QTimer::singleShot(0, this, [this]() {
- m_playHead->setPosition(0);
+ m_playHead->setTime(0);
m_widgetTimeline->viewTreeContent()->horizontalScrollBar()->setValue(0);
});
@@ -370,22 +370,12 @@ void TimelineGraphicsScene::setControllerText(const QString &controller)
void TimelineGraphicsScene::updateTimelineLayoutWidth()
{
double timelineWidth = TimelineConstants::RULER_EDGE_OFFSET * 2
- + m_ruler->maxDuration() * TimelineConstants::RULER_MILLI_W
- * m_ruler->timelineScale();
+ + m_ruler->timeToDistance(m_ruler->maxDuration());
m_layoutTimeline->setMinimumWidth(timelineWidth);
m_layoutTimeline->setMaximumWidth(timelineWidth);
}
-void TimelineGraphicsScene::updateControllerLayoutWidth()
-{
- if (m_layoutTimeline->count() < 2)
- return;
- auto root = m_layoutTimeline->itemAt(1);
-
- static_cast<RowTimeline *>(root->graphicsItem())->setEndTime(ruler()->duration());
-}
-
void TimelineGraphicsScene::updateController()
{
setControllerText(m_widgetTimeline->toolbar()->getCurrentController());