From 8d3fbf85e11ea7789e53e1ba0c6dc3a5034c89d0 Mon Sep 17 00:00:00 2001 From: "Justin F. Knotzke" Date: Mon, 22 Jun 2009 03:18:05 +0000 Subject: [PATCH] Berend De Schouwer A little tooltip highlighter to let you know power what you are looking at. --- src/PowerHist.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/PowerHist.cpp b/src/PowerHist.cpp index fffc94d3e..588235eb7 100644 --- a/src/PowerHist.cpp +++ b/src/PowerHist.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,32 @@ max(int a, int b) { if (a > b) return a; else return b; } static inline int min(int a, int b) { if (a < b) return a; else return b; } +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; + } + }; + + + + + // define a background class to handle shading of power zones // draws power zone bands IF zones are defined and the option // to draw bonds has been selected @@ -222,6 +249,8 @@ PowerHist::PowerHist(): grid->attach(this); zoneLabels = QList ::QList(); + + QwtPlotZoomer* zoomer = new penTooltip(this->canvas()); } PowerHist::~PowerHist() {