From 886bdd0fa43a2fcdeca306648b643b623af99f88 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 9 Feb 2016 17:38:28 -0200 Subject: 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. --- main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'main.cpp') 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("PM", 1, 0, "BarChart"); qmlRegisterType("PM", 1, 0, "VoronoiSplat"); qmlRegisterType("PM", 1, 0, "Colormap"); + qmlRegisterType("PM", 1, 0, "TransitionControl"); qmlRegisterSingletonType
("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("splat"); m->cpBarChart = engine.rootObjects()[0]->findChild("cpBarChart"); m->rpBarChart = engine.rootObjects()[0]->findChild("rpBarChart"); + TransitionControl *plotTC = engine.rootObjects()[0]->findChild("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 &))); // 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); -- cgit v1.2.3