Changes for Qwt6, but 2D plot still does not work...and should be checked if Qwt5 still works

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@100 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
bergamaschi
2012-10-22 15:34:14 +00:00
parent 6cec748335
commit 8715a416a0
11 changed files with 184 additions and 21 deletions

View File

@ -6,10 +6,10 @@
#ifndef SLSQT1DZOOMER_H
#define SLSQT1DZOOMER_H
#include <qwt_compat.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_global.h>
class SlsQtH1D;
class SlsQt1DZoomer:public QwtPlotZoomer{
@ -42,14 +42,24 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
bool SetLogX(bool yes) { return xIsLog=yes;}
bool SetLogY(bool yes) { return yIsLog=yes;}
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
#if QWT_VERSION<0x060000
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
#else
virtual QwtText trackerText(const QPointF &pos) const{
#endif
QColor bg(Qt::white);
#if QT_VERSION >= 0x040300
bg.setAlpha(200);
#endif
#if QWT_VERSION<0x060000
QwtText text = QwtPlotZoomer::trackerText(pos);
#else
QPoint p=pos.toPoint();
QwtText text = QwtPlotZoomer::trackerText(p);
#endif
text.setBackgroundBrush( QBrush( bg ));
return text;
}

View File

@ -77,7 +77,14 @@ class SlsQt2DHist: public QwtRasterData{
//just passes a pointer so that data is common to both the copy and the original instance
return (QwtRasterData*) this;
}
virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);}
#if QWT_VERSION<0x060000
virtual QwtDoubleInterval range() const{ return QwtDoubleInterval(z_min,z_max);}
#else
virtual QwtInterval range() const{ return QwtInterval(z_min,z_max);}
#endif
virtual double value(double x, double y) const{
//if(!interp){ //default is box like plot

View File

@ -16,6 +16,7 @@
#include <qwt_plot.h>
#include <qlist.h>
#include <qwt_plot_spectrogram.h>
#include "SlsQt2DZoomer.h"
@ -39,8 +40,14 @@ private:
QwtLinearColorMap* colorMapLinearScale;
QwtLinearColorMap* colorMapLogScale;
QwtLinearColorMap* currentColorMap;
#if QWT_VERSION<0x060000
QwtValueList* contourLevelsLinear;
QwtValueList* contourLevelsLog;
#else
QList<double> contourLevelsLinear;
QList<double> contourLevelsLog;
#endif
void SetupZoom();
void SetupColorMap();

View File

@ -27,7 +27,12 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
hist=h;
}
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
#if QWT_VERSION<0x060000
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
#else
virtual QwtText trackerText(const QPointF &pos) const{
#endif
QColor bg(Qt::white);
#if QT_VERSION >= 0x040300
bg.setAlpha(200);
@ -41,8 +46,15 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
static char t[200];
sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y()));
text.setText(t);
}else text = QwtPlotZoomer::trackerText(pos);
}else {
#if QWT_VERSION<0x060000
QwtText text = QwtPlotZoomer::trackerText(pos);
#else
QPoint p=pos.toPoint();
QwtText text = QwtPlotZoomer::trackerText(p);
#endif
}
text.setBackgroundBrush( QBrush( bg ));
return text;
}