From fdffe8dc1ee0d9a5e6dc8614d532d3aa60603297 Mon Sep 17 00:00:00 2001 From: wang_x1 Date: Fri, 2 Sep 2016 16:22:34 +0200 Subject: [PATCH] compatible with qwt 6.1 --- .../slsDetectorPlotting/include/SlsQt1DZoomer.h | 4 ++++ .../slsDetectorPlotting/include/SlsQt2DZoomer.h | 4 ++++ .../slsDetectorPlotting/src/SlsQt1DPlot.cxx | 12 ++++++++---- .../slsDetectorPlotting/src/SlsQt1DZoomer.cxx | 10 ++++++++-- .../slsDetectorPlotting/src/SlsQt2DPlot.cxx | 5 +++++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h index 378b6f787..3bcb35ee7 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h @@ -27,7 +27,11 @@ class SlsQt1DZoomer:public QwtPlotZoomer{ bool xIsLog,yIsLog; public: +#if QWT_VERSION < 0x060100 SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ +#else + SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){ +#endif setTrackerMode(AlwaysOn); xIsLog=yIsLog=0; } diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h index 497dc7971..5fed37f1a 100644 --- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h +++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h @@ -30,7 +30,11 @@ class SlsQt2DZoomer:public QwtPlotZoomer{ SlsQt2DHist* hist; public: +#if QWT_VERSION < 0x060100 SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ +#else + SlsQt2DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){ +#endif setTrackerMode(AlwaysOn); } diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx index 7942628c8..1382e0e50 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx @@ -16,6 +16,10 @@ #include #include "SlsQt1DPlot.h" +#if QWT_VERSION >= 0x060100 +#define QwtLog10ScaleEngine QwtLogScaleEngine +#endif + using namespace std; SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){ @@ -417,7 +421,7 @@ void SlsQt1DPlot::SetupZoom(){ #endif zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); - panner = new QwtPlotPanner(canvas()); + panner = new QwtPlotPanner((QwtPlotCanvas*)canvas()); panner->setAxisEnabled(QwtPlot::yRight, false); panner->setMouseButton(Qt::MidButton); @@ -440,8 +444,8 @@ void SlsQt1DPlot::alignScales(){ // the canvas frame, but is also a good example demonstrating // why the spreaded API needs polishing. - canvas()->setFrameStyle(QFrame::Box | QFrame::Plain ); - canvas()->setLineWidth(1); + ((QwtPlotCanvas*)canvas())->setFrameStyle(QFrame::Box | QFrame::Plain ); + ((QwtPlotCanvas*)canvas())->setLineWidth(1); for(int i = 0; i < QwtPlot::axisCnt; i++ ){ QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i); @@ -460,7 +464,7 @@ void SlsQt1DPlot::UnknownStuff(){ canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); #else // We don't need the cache here - canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore, false); + ((QwtPlotCanvas*)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false); #endif diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx index f8dd8c20b..31386094e 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx @@ -38,9 +38,12 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y #if QWT_VERSION < 0x50200 float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound(); float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound(); - #else + #elif QWT_VERSION < 0x060100 float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound(); float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound(); + #else + float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound(); + float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound(); #endif if(xmin_currxmin+x_width) xmax_curr=xmin+x_width; @@ -50,9 +53,12 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y #if QWT_VERSION < 0x50200 float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound(); float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound(); - #else + #elif QWT_VERSION < 0x060100 float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound(); float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound(); + #else + float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound(); + float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound(); #endif if(ymin_currymin+y_width) ymax_curr=ymin+y_width; diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx index edd496627..5875806e2 100644 --- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx +++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx @@ -5,6 +5,7 @@ */ +#include #include #include #include @@ -23,6 +24,10 @@ #include #include "SlsQt2DPlot.h" + +#if QWT_VERSION >= 0x060100 +#define QwtLog10ScaleEngine QwtLogScaleEngine +#endif using namespace std;