maliakal_d 9f851d6156 Creating Classes, Libraries and Functions for the Common SLS Detector GUI
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@1 af1100a4-978c-4157-bff7-07162d2ba061
2012-05-21 16:00:26 +00:00

52 lines
925 B
C++

/**
* @author Ian Johnson
* @version 1.0
*/
#ifndef SLSQT2DZOOMER_H
#define SLSQT2DZOOMER_H
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include "SlsQt2DHist.h"
class SlsQt2DZoomer:public QwtPlotZoomer{
private:
SlsQt2DHist* hist;
public:
SlsQt2DZoomer(QwtPlotCanvas *canvas):QwtPlotZoomer(canvas){
setTrackerMode(AlwaysOn);
}
void SetHist(SlsQt2DHist* h){
hist=h;
}
virtual QwtText trackerText(const QwtDoublePoint &pos) const{
QColor bg(Qt::white);
#if QT_VERSION >= 0x040300
bg.setAlpha(200);
#endif
//QwtText text = QwtPlotZoomer::trackerText(pos);
static QwtText text;
if(hist){
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);
text.setBackgroundBrush( QBrush( bg ));
return text;
}
};
#endif