From 2ae04662b85d4898fe7069ed18cce2dd7abc45ad Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Thu, 3 Mar 2016 17:00:47 -0300 Subject: BarChart is now also updated during rewinding. In addition, rewinding is now done with Ctrl+RMB. --- barchart.cpp | 11 +++++++++++ barchart.h | 1 + main.cpp | 4 +++- transitioncontrol.cpp | 5 +++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/barchart.cpp b/barchart.cpp index e651ccd..65db7d8 100644 --- a/barchart.cpp +++ b/barchart.cpp @@ -78,6 +78,17 @@ void BarChart::setValues(const arma::vec &values) update(); } +void BarChart::updateValues(const arma::vec &values) +{ + if (m_values.n_elem != values.n_elem) { + return; + } + + m_values = values; + m_shouldUpdateBars = true; + update(); +} + void BarChart::setColorScale(const ColorScale *scale) { m_colorScale = scale; diff --git a/barchart.h b/barchart.h index 28a9fa9..589b5e5 100644 --- a/barchart.h +++ b/barchart.h @@ -28,6 +28,7 @@ signals: public slots: void setValues(const arma::vec &values); + void updateValues(const arma::vec &values); void setColorScale(const ColorScale *scale); void setSelection(const std::vector &selection); void brushItem(int item); diff --git a/main.cpp b/main.cpp index 3417534..1062546 100644 --- a/main.cpp +++ b/main.cpp @@ -289,9 +289,11 @@ int main(int argc, char **argv) m->cpPlot, &Scatterplot::setColorData); QObject::connect(m->projectionHistory, &ProjectionHistory::rpValuesRewound, m->splat, &VoronoiSplat::setValues); + QObject::connect(m->projectionHistory, &ProjectionHistory::rpValuesRewound, + m->rpBarChart, &BarChart::updateValues); // General component set up - plotTC->setAcceptedMouseButtons(Qt::MiddleButton); + plotTC->setAcceptedMouseButtons(Qt::RightButton); m->cpPlot->setDragEnabled(true); m->cpPlot->setAutoScale(false); m->rpPlot->setAutoScale(false); diff --git a/transitioncontrol.cpp b/transitioncontrol.cpp index ca12e61..51f07f0 100644 --- a/transitioncontrol.cpp +++ b/transitioncontrol.cpp @@ -6,7 +6,7 @@ #include "transitionworkerthread.h" // The mouse button used for interaction -static const Qt::MouseButton MOUSE_BUTTON = Qt::MiddleButton; +static const Qt::MouseButton MOUSE_BUTTON = Qt::RightButton; TransitionControl::TransitionControl(QQuickItem *parent) : QQuickItem(parent) @@ -28,7 +28,8 @@ void TransitionControl::setT(double t) void TransitionControl::mousePressEvent(QMouseEvent *event) { - if (event->button() != MOUSE_BUTTON) { + if (event->button() != MOUSE_BUTTON + || !(event->modifiers() & Qt::ControlModifier)) { event->ignore(); return; } -- cgit v1.2.3