implemented automatically switching to the hand tool when middle clicking on

all TimelineViewBase derivatives
This commit is contained in:
itsmattkc
2020-01-02 05:44:40 +11:00
parent dd77ea46a5
commit 8b2514c1de
11 changed files with 125 additions and 117 deletions
@@ -30,7 +30,6 @@
#include "config/config.h"
#include "common/flipmodifiers.h"
#include "common/timecodefunctions.h"
#include "core.h"
#include "node/input/media/media.h"
#include "project/item/footage/footage.h"
@@ -42,7 +41,6 @@ TimelineView::TimelineView(const TrackType &type, Qt::Alignment vertical_alignme
Q_ASSERT(vertical_alignment == Qt::AlignTop || vertical_alignment == Qt::AlignBottom);
setAlignment(Qt::AlignLeft | vertical_alignment);
setDragMode(NoDrag);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setBackgroundRole(QPalette::Window);
setContextMenuPolicy(Qt::CustomContextMenu);
@@ -69,11 +67,16 @@ void TimelineView::DeselectAll()
void TimelineView::mousePressEvent(QMouseEvent *event)
{
if (PlayheadPress(event)) {
if (HandPress(event) || PlayheadPress(event)) {
// Let the parent handle this
return;
}
if (dragMode() != GetDefaultDragMode()) {
TimelineViewBase::mousePressEvent(event);
return;
}
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event->pos(), event->modifiers());
emit MousePressed(&timeline_event);
@@ -81,11 +84,16 @@ void TimelineView::mousePressEvent(QMouseEvent *event)
void TimelineView::mouseMoveEvent(QMouseEvent *event)
{
if (PlayheadMove(event)) {
if (HandMove(event) || PlayheadMove(event)) {
// Let the parent handle this
return;
}
if (dragMode() != GetDefaultDragMode()) {
TimelineViewBase::mouseMoveEvent(event);
return;
}
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event->pos(), event->modifiers());
emit MouseMoved(&timeline_event);
@@ -93,11 +101,16 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event)
void TimelineView::mouseReleaseEvent(QMouseEvent *event)
{
if (PlayheadRelease(event)) {
if (HandRelease(event) || PlayheadRelease(event)) {
// Let the parent handle this
return;
}
if (dragMode() != GetDefaultDragMode()) {
TimelineViewBase::mouseReleaseEvent(event);
return;
}
TimelineViewMouseEvent timeline_event = CreateMouseEvent(event->pos(), event->modifiers());
emit MouseReleased(&timeline_event);