diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-03-03 17:00:47 -0300 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-03-03 17:00:47 -0300 |
commit | 2ae04662b85d4898fe7069ed18cce2dd7abc45ad (patch) | |
tree | a1c1e49f9b7c568162a79a7bb7de9ecfd4986d1c | |
parent | 3ce49858c6859fccc2e4d35839c34685348790d1 (diff) |
BarChart is now also updated during rewinding.
In addition, rewinding is now done with Ctrl+RMB.
-rw-r--r-- | barchart.cpp | 11 | ||||
-rw-r--r-- | barchart.h | 1 | ||||
-rw-r--r-- | main.cpp | 4 | ||||
-rw-r--r-- | 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; @@ -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<bool> &selection); void brushItem(int item); @@ -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; } |