mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
compatible with qwt 6.1
This commit is contained in:
parent
b8944a3156
commit
fdffe8dc1e
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <qprinter.h>
|
#include <qprinter.h>
|
||||||
#include <qtoolbutton.h>
|
#include <qtoolbutton.h>
|
||||||
@ -24,6 +25,10 @@
|
|||||||
|
|
||||||
#include "SlsQt2DPlot.h"
|
#include "SlsQt2DPlot.h"
|
||||||
|
|
||||||
|
#if QWT_VERSION >= 0x060100
|
||||||
|
#define QwtLog10ScaleEngine QwtLogScaleEngine
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){
|
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent):QwtPlot(parent){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user