aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2016-02-09 17:38:28 -0200
committerSamuel Fadel <samuelfadel@gmail.com>2016-02-09 17:38:28 -0200
commit886bdd0fa43a2fcdeca306648b643b623af99f88 (patch)
tree7ffa1e622724862b8b99387199fb1ef7cbf79b28 /main.cpp
parent962114b867c044240919ebc558c0b25f105db963 (diff)
Added TransitionControl and plot rewinding.
New component overlays main view and handles middle clicks/drags to performing rewinding. Also sports smooth transitioning back to current projection whenever the mouse button is lifted. Next up, the same kind of transitions in the displayed values.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 47bea3d..b1a8e8b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -16,6 +16,7 @@
#include "voronoisplat.h"
#include "barchart.h"
#include "colormap.h"
+#include "transitioncontrol.h"
#include "manipulationhandler.h"
#include "mapscalehandler.h"
#include "selectionhandler.h"
@@ -142,6 +143,7 @@ int main(int argc, char **argv)
qmlRegisterType<BarChart>("PM", 1, 0, "BarChart");
qmlRegisterType<VoronoiSplat>("PM", 1, 0, "VoronoiSplat");
qmlRegisterType<Colormap>("PM", 1, 0, "Colormap");
+ qmlRegisterType<TransitionControl>("PM", 1, 0, "TransitionControl");
qmlRegisterSingletonType<Main>("PM", 1, 0, "Main", mainProvider);
QQmlApplicationEngine engine(QUrl("qrc:///main_view.qml"));
@@ -153,6 +155,7 @@ int main(int argc, char **argv)
m->splat = engine.rootObjects()[0]->findChild<VoronoiSplat *>("splat");
m->cpBarChart = engine.rootObjects()[0]->findChild<BarChart *>("cpBarChart");
m->rpBarChart = engine.rootObjects()[0]->findChild<BarChart *>("rpBarChart");
+ TransitionControl *plotTC = engine.rootObjects()[0]->findChild<TransitionControl *>("plotTC");
// Keep track of the current cp (in order to save them later, if requested)
QObject::connect(m->cpPlot, SIGNAL(xyChanged(const arma::mat &)),
@@ -171,6 +174,8 @@ int main(int argc, char **argv)
m->rpPlot, SLOT(setXY(const arma::mat &)));
QObject::connect(&manipulationHandler, SIGNAL(rpChanged(const arma::mat &)),
m->splat, SLOT(setSites(const arma::mat &)));
+ QObject::connect(plotTC, SIGNAL(tChanged(double)),
+ &manipulationHandler, SLOT(setRewind(double)));
// Keep both scatterplots and the splat scaled equally and relative to the
// full plot
@@ -246,10 +251,12 @@ int main(int argc, char **argv)
&projectionObserver, SLOT(setRPSelection(const std::vector<bool> &)));
// General component set up
+ plotTC->setAcceptedMouseButtons(Qt::MiddleButton);
m->cpPlot->setDragEnabled(true);
m->cpPlot->setAutoScale(false);
m->rpPlot->setGlyphSize(3.0f);
m->rpPlot->setAutoScale(false);
+ m->cpBarChart->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
m->setSelectCPs();
m->cpBarChart->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);