From ca26791dcb73b16cc798549cc22c48ec0c6aaa6e Mon Sep 17 00:00:00 2001 From: "Justin F. Knotzke" Date: Sun, 21 Jun 2009 14:10:16 +0000 Subject: [PATCH] Berend De Schouwer A little tooltip highlighter to let you know power what you are looking at. --- src/PowerHist.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/PowerHist.cpp b/src/PowerHist.cpp index 66c68c005..293d2040d 100644 --- a/src/PowerHist.cpp +++ b/src/PowerHist.cpp @@ -23,10 +23,33 @@ #include #include #include +#include #include #include #include +class penTooltip: public QwtPlotZoomer +{ +public: + penTooltip(QwtPlotCanvas *canvas): + QwtPlotZoomer(canvas) + { + setTrackerMode(AlwaysOn); + } + + virtual QwtText trackerText(const QwtDoublePoint &pos) const + { + QColor bg(Qt::white); +#if QT_VERSION >= 0x040300 + bg.setAlpha(200); +#endif + + QwtText text = QString("%1").arg((int)pos.x()); + text.setBackgroundBrush( QBrush( bg )); + return text; + } +}; + PowerHist::PowerHist() : array(NULL), binw(20), withz(true), lny(false) { @@ -47,6 +70,8 @@ PowerHist::PowerHist() : gridPen.setStyle(Qt::DotLine); grid->setPen(gridPen); grid->attach(this); + + QwtPlotZoomer* zoomer = new penTooltip(this->canvas()); } PowerHist::~PowerHist() {