From 44fd164525c8f7593ddffd9302e23abfe155e69f Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 13 Jun 2014 09:30:17 +0100 Subject: [PATCH] Enable Curve Isolation on Trends chart .. isolation used on AllPlot when hover on axes is equally useful on the LTM trends chart. --- src/LTMPlot.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++-- src/LTMPlot.h | 9 ++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/LTMPlot.cpp b/src/LTMPlot.cpp index b0c31cf59..0c21b6595 100644 --- a/src/LTMPlot.cpp +++ b/src/LTMPlot.cpp @@ -47,7 +47,7 @@ #include // for isinf() isnan() LTMPlot::LTMPlot(LTMWindow *parent, Context *context, bool first) : - bg(NULL), parent(parent), context(context), highlighter(NULL), first(first) + bg(NULL), parent(parent), context(context), highlighter(NULL), first(first), isolation(false) { // don't do this .. setAutoReplot(false); @@ -120,6 +120,8 @@ LTMPlot::LTMPlot(LTMWindow *parent, Context *context, bool first) : picker->setEnabled(true); _canvasPicker = new LTMCanvasPicker(this); + curveColors = new CurveColors(this); + settings = NULL; cogganPMC = skibaPMC = NULL; // cache when replotting a PMC @@ -129,7 +131,6 @@ LTMPlot::LTMPlot(LTMWindow *parent, Context *context, bool first) : // connect pickers to ltmPlot connect(_canvasPicker, SIGNAL(pointHover(QwtPlotCurve*, int)), this, SLOT(pointHover(QwtPlotCurve*, int))); connect(_canvasPicker, SIGNAL(pointClicked(QwtPlotCurve*, int)), this, SLOT(pointClicked(QwtPlotCurve*, int))); - } LTMPlot::~LTMPlot() @@ -151,9 +152,18 @@ LTMPlot::configUpdate() palette.setColor(QPalette::Text, GColor(CPLOTMARKER)); setPalette(palette); + axesObject.clear(); + axesId.clear(); foreach (QwtAxisId x, supportedAxes) { axisWidget(x)->setPalette(palette); axisWidget(x)->setPalette(palette); + + // keep track + axisWidget(x)->removeEventFilter(this); + axisWidget(x)->installEventFilter(this); + axesObject << axisWidget(x); + axesId << x; + } axisWidget(QwtPlot::xBottom)->setPalette(palette); QwtLegend *l = static_cast(this->legend()); @@ -163,6 +173,7 @@ LTMPlot::configUpdate() w->setPalette(palette); } } + curveColors->saveState(); updateLegend(); } @@ -269,6 +280,8 @@ LTMPlot::setData(LTMSettings *set) enableAxis(supportedAxes[i].id, false); } axes.clear(); + axesObject.clear(); + axesId.clear(); // reset all min/max Y values for (int i=0; i<10; i++) minY[i]=0, maxY[i]=0; @@ -1212,6 +1225,8 @@ LTMPlot::setCompareData(LTMSettings *set) enableAxis(supportedAxes[i].id, false); } axes.clear(); + axesObject.clear(); + axesId.clear(); // reset all min/max Y values for (int i=0; i<10; i++) minY[i]=0, maxY[i]=0; @@ -2632,12 +2647,57 @@ LTMPlot::chooseYAxis(QString units) setAxisVisible(chosen, true); axes.insert(units, chosen); return chosen; + } else { // eek! return QwtAxis::yLeft; // just re-use the current yLeft axis } } +bool +LTMPlot::eventFilter(QObject *obj, QEvent *event) +{ + // is it for other objects ? + if (axesObject.contains(obj)) { + + QwtAxisId id = axesId.at(axesObject.indexOf(obj)); + + // this is an axes widget + //qDebug()< curves; // metric symbol with curve object QHash axes; // units and associated axis + QList axesObject; + QList axesId; + QList labels; // labels LTMScaleDraw *scale; QwtPlotGrid *grid; @@ -120,7 +127,7 @@ class LTMPlot : public QwtPlot StressCalculator *cogganPMC, *skibaPMC; QList supportedAxes; - bool first; + bool first, isolation; int MAXX; };