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
+4 -14
View File
@@ -15,11 +15,10 @@ KeyframeViewBase::KeyframeViewBase(QWidget *parent) :
dragging_bezier_point_(nullptr),
y_axis_enabled_(false)
{
setDragMode(RubberBandDrag);
SetDefaultDragMode(RubberBandDrag);
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &KeyframeViewBase::customContextMenuRequested, this, &KeyframeViewBase::ShowContextMenu);
connect(Core::instance(), &Core::ToolChanged, this, &KeyframeViewBase::ApplicationToolChanged);
}
void KeyframeViewBase::Clear()
@@ -67,7 +66,7 @@ KeyframeViewItem *KeyframeViewBase::AddKeyframeInternal(NodeKeyframePtr key)
void KeyframeViewBase::mousePressEvent(QMouseEvent *event)
{
if (PlayheadPress(event)) {
if (HandPress(event) || PlayheadPress(event)) {
return;
}
@@ -107,7 +106,7 @@ void KeyframeViewBase::mousePressEvent(QMouseEvent *event)
void KeyframeViewBase::mouseMoveEvent(QMouseEvent *event)
{
if (PlayheadMove(event)) {
if (HandMove(event) || PlayheadMove(event)) {
return;
}
@@ -138,7 +137,7 @@ void KeyframeViewBase::mouseMoveEvent(QMouseEvent *event)
void KeyframeViewBase::mouseReleaseEvent(QMouseEvent *event)
{
if (PlayheadRelease(event)) {
if (HandRelease(event) || PlayheadRelease(event)) {
return;
}
@@ -389,12 +388,3 @@ void KeyframeViewBase::ShowKeyframePropertiesDialog()
}
}
void KeyframeViewBase::ApplicationToolChanged(Tool::Item tool)
{
if (tool == Tool::kHand) {
setDragMode(ScrollHandDrag);
} else {
setDragMode(RubberBandDrag);
}
}