From d61478eb3220a8e085d3dfd66f7327a830d2c09e Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 9 Feb 2016 11:42:18 -0200 Subject: Revert "Scatterplot: interaction now happens only via left mouse button." This reverts commit d79e037df56236c7d0f0824853b292d15ab75c27. --- main.h | 4 ++-- scatterplot.cpp | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/main.h b/main.h index 550b0e4..d3184da 100644 --- a/main.h +++ b/main.h @@ -62,7 +62,7 @@ public: cpPlot->setAcceptedMouseButtons(Qt::NoButton); cpPlot->setAcceptHoverEvents(false); - rpPlot->setAcceptedMouseButtons(Qt::LeftButton); + rpPlot->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton); rpPlot->setAcceptHoverEvents(true); } @@ -70,7 +70,7 @@ public: rpPlot->setAcceptedMouseButtons(Qt::NoButton); rpPlot->setAcceptHoverEvents(false); - cpPlot->setAcceptedMouseButtons(Qt::LeftButton); + cpPlot->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton); cpPlot->setAcceptHoverEvents(true); } diff --git a/scatterplot.cpp b/scatterplot.cpp index ca65c2c..f501267 100644 --- a/scatterplot.cpp +++ b/scatterplot.cpp @@ -31,9 +31,6 @@ static const QColor CROSSHAIR_COLOR2(0, 0, 0); // Selection settings static const QColor SELECTION_COLOR(128, 128, 128, 96); -// The mouse button used for interaction -static const Qt::MouseButton MOUSE_BUTTON = Qt::LeftButton; - class QuadTree { public: @@ -585,10 +582,6 @@ void Scatterplot::updateBrush(QSGNode *node) void Scatterplot::mousePressEvent(QMouseEvent *event) { - if (!(event->buttons() & MOUSE_BUTTON)) { - return; - } - switch (m_interactionState) { case STATE_NONE: case STATE_SELECTED: @@ -609,10 +602,6 @@ void Scatterplot::mousePressEvent(QMouseEvent *event) void Scatterplot::mouseMoveEvent(QMouseEvent *event) { - if (!(event->buttons() & MOUSE_BUTTON)) { - return; - } - switch (m_interactionState) { case STATE_SELECTING: m_dragCurrentPos = event->localPos(); @@ -634,13 +623,6 @@ void Scatterplot::mouseMoveEvent(QMouseEvent *event) void Scatterplot::mouseReleaseEvent(QMouseEvent *event) { - if (event->buttons() & MOUSE_BUTTON) { - // From the docs: for mouse release events, buttons() excludes the - // button that caused the event. Therefore, we bail out if the button is - // included in buttons(). - return; - } - switch (m_interactionState) { case STATE_NONE: case STATE_SELECTED: -- cgit v1.2.3