aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-03-03 17:00:47 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2016-03-03 17:00:47 -0300
commit2ae04662b85d4898fe7069ed18cce2dd7abc45ad (patch)
treea1c1e49f9b7c568162a79a7bb7de9ecfd4986d1c
parent3ce49858c6859fccc2e4d35839c34685348790d1 (diff)
BarChart is now also updated during rewinding.
In addition, rewinding is now done with Ctrl+RMB.
-rw-r--r--barchart.cpp11
-rw-r--r--barchart.h1
-rw-r--r--main.cpp4
-rw-r--r--transitioncontrol.cpp5
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<bool> &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;
}