compatible with qwt 6.1

This commit is contained in:
wang_x1 2016-09-02 16:22:34 +02:00
parent b8944a3156
commit fdffe8dc1e
5 changed files with 29 additions and 6 deletions

View File

@ -27,7 +27,11 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
bool xIsLog,yIsLog; bool xIsLog,yIsLog;
public: public:
#if QWT_VERSION < 0x060100
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
#else
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
#endif
setTrackerMode(AlwaysOn); setTrackerMode(AlwaysOn);
xIsLog=yIsLog=0; xIsLog=yIsLog=0;
} }

View File

@ -30,7 +30,11 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
SlsQt2DHist* hist; SlsQt2DHist* hist;
public: public:
#if QWT_VERSION < 0x060100
SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){ SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
#else
SlsQt2DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
#endif
setTrackerMode(AlwaysOn); setTrackerMode(AlwaysOn);
} }

View File

@ -16,6 +16,10 @@
#include <qwt_math.h> #include <qwt_math.h>
#include "SlsQt1DPlot.h" #include "SlsQt1DPlot.h"
#if QWT_VERSION >= 0x060100
#define QwtLog10ScaleEngine QwtLogScaleEngine
#endif
using namespace std; using namespace std;
SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){ SlsQtH1D::SlsQtH1D(QString title,int n, double min, double max, double* data):QwtPlotCurve(title){
@ -417,7 +421,7 @@ void SlsQt1DPlot::SetupZoom(){
#endif #endif
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton); zoomer->setMousePattern(QwtEventPattern::MouseSelect3,Qt::RightButton);
panner = new QwtPlotPanner(canvas()); panner = new QwtPlotPanner((QwtPlotCanvas*)canvas());
panner->setAxisEnabled(QwtPlot::yRight, false); panner->setAxisEnabled(QwtPlot::yRight, false);
panner->setMouseButton(Qt::MidButton); panner->setMouseButton(Qt::MidButton);
@ -440,8 +444,8 @@ void SlsQt1DPlot::alignScales(){
// the canvas frame, but is also a good example demonstrating // the canvas frame, but is also a good example demonstrating
// why the spreaded API needs polishing. // why the spreaded API needs polishing.
canvas()->setFrameStyle(QFrame::Box | QFrame::Plain ); ((QwtPlotCanvas*)canvas())->setFrameStyle(QFrame::Box | QFrame::Plain );
canvas()->setLineWidth(1); ((QwtPlotCanvas*)canvas())->setLineWidth(1);
for(int i = 0; i < QwtPlot::axisCnt; i++ ){ for(int i = 0; i < QwtPlot::axisCnt; i++ ){
QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i); QwtScaleWidget *scaleWidget = (QwtScaleWidget *)axisWidget(i);
@ -460,7 +464,7 @@ void SlsQt1DPlot::UnknownStuff(){
canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false); canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
#else #else
// We don't need the cache here // We don't need the cache here
canvas()->setPaintAttribute(QwtPlotCanvas::BackingStore, false); ((QwtPlotCanvas*)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
#endif #endif

View File

@ -38,9 +38,12 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
#if QWT_VERSION < 0x50200 #if QWT_VERSION < 0x50200
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound(); float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound(); float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->hBound();
#else #elif QWT_VERSION < 0x060100
float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound(); float xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->lowerBound();
float xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom)->upperBound(); 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 #endif
if(xmin_curr<xmin) xmin_curr=xmin; if(xmin_curr<xmin) xmin_curr=xmin;
if(xmax_curr>xmin+x_width) xmax_curr=xmin+x_width; if(xmax_curr>xmin+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 #if QWT_VERSION < 0x50200
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound(); float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound(); float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->hBound();
#else #elif QWT_VERSION < 0x060100
float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound(); float ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->lowerBound();
float ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft)->upperBound(); 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 #endif
if(ymin_curr<ymin) ymin_curr=ymin; if(ymin_curr<ymin) ymin_curr=ymin;
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width; if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;

View File

@ -5,6 +5,7 @@
*/ */
#include <cmath>
#include <iostream> #include <iostream>
#include <qprinter.h> #include <qprinter.h>
#include <qtoolbutton.h> #include <qtoolbutton.h>
@ -23,6 +24,10 @@
#include <qwt_scale_engine.h> #include <qwt_scale_engine.h>
#include "SlsQt2DPlot.h" #include "SlsQt2DPlot.h"
#if QWT_VERSION >= 0x060100
#define QwtLog10ScaleEngine QwtLogScaleEngine
#endif
using namespace std; using namespace std;