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;
public:
#if QWT_VERSION < 0x060100
SlsQt1DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
#else
SlsQt1DZoomer(QWidget *canvas):QwtPlotZoomer(canvas){
#endif
setTrackerMode(AlwaysOn);
xIsLog=yIsLog=0;
}

View File

@ -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);
}

View File

@ -16,6 +16,10 @@
#include <qwt_math.h>
#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

View File

@ -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_curr<xmin) xmin_curr=xmin;
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
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_curr<ymin) ymin_curr=ymin;
if(ymax_curr>ymin+y_width) ymax_curr=ymin+y_width;

View File

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