From 5c4878a00a4f544cbc33cc09d97d9964d9ba750e Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 24 Jul 2020 13:35:04 -0400 Subject: [PATCH] Display cursor position on Wide graph as a ToolTip. --- widgets/plotter.cpp | 8 ++++++++ widgets/plotter.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/widgets/plotter.cpp b/widgets/plotter.cpp index fb65bd775..c21d7e5f0 100644 --- a/widgets/plotter.cpp +++ b/widgets/plotter.cpp @@ -56,6 +56,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent, false); setAttribute(Qt::WA_NoSystemBackground, true); + setMouseTracking(true); m_bReplot=false; // contextual pop up menu @@ -697,6 +698,13 @@ void CPlotter::setRxFreq (int x) //setRxFreq int CPlotter::rxFreq() {return m_rxFreq;} //rxFreq +void CPlotter::mouseMoveEvent (QMouseEvent * event) +{ + int x=event->x(); + QToolTip::showText(event->globalPos(),QString::number(int(FreqfromX(x)))); + QWidget::mouseMoveEvent(event); +} + void CPlotter::mouseReleaseEvent (QMouseEvent * event) { if (Qt::LeftButton == event->button () and m_mode!="FST4W") { diff --git a/widgets/plotter.h b/widgets/plotter.h index b3eb85855..b4b4cf42b 100644 --- a/widgets/plotter.h +++ b/widgets/plotter.h @@ -13,6 +13,7 @@ #include #include #include +#include #define VERT_DIVS 7 //specify grid screen divisions #define HORZ_DIVS 20 @@ -91,6 +92,7 @@ protected: //re-implemented widget event handlers void paintEvent(QPaintEvent *event) override; void resizeEvent(QResizeEvent* event) override; + void mouseMoveEvent(QMouseEvent * event) override; void mouseReleaseEvent (QMouseEvent * event) override; void mouseDoubleClickEvent (QMouseEvent * event) override;