diff --git a/app/widget/timebased/timebasedwidget.cpp b/app/widget/timebased/timebasedwidget.cpp index add053974..b91f44e9f 100644 --- a/app/widget/timebased/timebasedwidget.cpp +++ b/app/widget/timebased/timebasedwidget.cpp @@ -46,6 +46,7 @@ TimeBasedWidget::TimeBasedWidget(bool ruler_text_visible, bool ruler_cache_statu ruler_ = new TimeRuler(ruler_text_visible, ruler_cache_status_visible, this); ConnectTimelineView(ruler_, true); ruler()->SetSnapService(this); + connect(ruler(), &TimeRuler::DragReleased, this, static_cast(&TimeBasedWidget::StopCatchUpScrollTimer)); scrollbar_ = new ResizableTimelineScrollBar(Qt::Horizontal, this); connect(scrollbar_, &ResizableScrollBar::ResizeBegan, this, &TimeBasedWidget::ScrollBarResizeBegan); @@ -348,7 +349,7 @@ void TimeBasedWidget::SetTime(const rational &time) { if (UserIsDraggingPlayhead()) { // If the user is dragging the playhead, we will simply nudge over and not use autoscroll rules. - QMetaObject::invokeMethod(this, "CatchUpScrollToPlayhead", Qt::QueuedConnection); + SetCatchUpScrollValue(qRound(TimeToScene(time)) - scrollbar_->value()); } else { // Otherwise, assume we jumped to this out of nowhere and must now autoscroll switch (static_cast(OLIVE_CONFIG("Autoscroll").toInt())) { diff --git a/app/widget/timebased/timebasedwidget.h b/app/widget/timebased/timebasedwidget.h index 905a22fb4..ce00a3e1e 100644 --- a/app/widget/timebased/timebasedwidget.h +++ b/app/widget/timebased/timebasedwidget.h @@ -121,9 +121,6 @@ public slots: void DeleteSelected(); -protected slots: - void SetTimeAndSignal(const rational& t); - protected: ResizableTimelineScrollBar* scrollbar() const; @@ -153,10 +150,6 @@ protected: void SetCatchUpScrollValue(QScrollBar *b, int v, int maximum); void SetCatchUpScrollValue(int v); void StopCatchUpScrollTimer(QScrollBar *b); - void StopCatchUpScrollTimer() - { - StopCatchUpScrollTimer(scrollbar_); - } virtual const QVector *GetSnapBlocks() const { return nullptr; } virtual const QVector *GetSnapKeyframes() const { return nullptr; } @@ -177,6 +170,13 @@ protected slots: static void PageScrollInternal(QScrollBar* bar, int maximum, int screen_position, bool whole_page_scroll); + void SetTimeAndSignal(const olive::rational& t); + + void StopCatchUpScrollTimer() + { + StopCatchUpScrollTimer(scrollbar_); + } + signals: void TimeChanged(const rational&); diff --git a/app/widget/timeruler/seekablewidget.cpp b/app/widget/timeruler/seekablewidget.cpp index 5f130485f..3ef5a135c 100644 --- a/app/widget/timeruler/seekablewidget.cpp +++ b/app/widget/timeruler/seekablewidget.cpp @@ -231,6 +231,7 @@ void SeekableWidget::mouseReleaseEvent(QMouseEvent *event) } dragging_ = false; + emit DragReleased(); } void SeekableWidget::mouseDoubleClickEvent(QMouseEvent *event) diff --git a/app/widget/timeruler/seekablewidget.h b/app/widget/timeruler/seekablewidget.h index d29686f8f..6e16592f5 100644 --- a/app/widget/timeruler/seekablewidget.h +++ b/app/widget/timeruler/seekablewidget.h @@ -78,6 +78,9 @@ public slots: virtual void TimebaseChangedEvent(const rational &) override; +signals: + void DragReleased(); + protected: virtual void mousePressEvent(QMouseEvent *event) override; virtual void mouseMoveEvent(QMouseEvent *event) override;