From 7a57a399e07784a805b192fa7ec65a693df63101 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 14 May 2021 14:14:39 -0400 Subject: [PATCH] Display cursor frequency on Wide graph (upper and lower) as a ToolTip. --- map65/plotter.cpp | 18 ++++++++++++++++++ map65/plotter.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/map65/plotter.cpp b/map65/plotter.cpp index 245264dd3..20b0f81b6 100644 --- a/map65/plotter.cpp +++ b/map65/plotter.cpp @@ -16,6 +16,7 @@ CPlotter::CPlotter(QWidget *parent) : //CPlotter Constructor setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent, false); setAttribute(Qt::WA_NoSystemBackground, true); + setMouseTracking(true); m_StartFreq = 100; m_nSpan=65; //Units: kHz @@ -763,6 +764,23 @@ void CPlotter::setLockTxRx(bool b) } } +void CPlotter::mouseMoveEvent (QMouseEvent * event) +{ + int h = m_WaterfallPixmap.height(); + int x=event->x(); + int y=event->y(); + bool lower=(y > 30+h); + float freq=FreqfromX(x); + float df=m_fSample/32768.0; + int ndf=x*df + m_ZoomStartFreq; + if(lower) { + QToolTip::showText(event->globalPos(),QString::number(ndf)); + } else { + QToolTip::showText(event->globalPos(),QString::number(freq)); + } + QWidget::mouseMoveEvent(event); +} + double CPlotter::rxFreq() { return floor(datcom_.fcenter) + 0.001*m_fQSO + 0.000001*m_DF; diff --git a/map65/plotter.h b/map65/plotter.h index 2d372c6c6..6f2922458 100644 --- a/map65/plotter.h +++ b/map65/plotter.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "commons.h" @@ -82,6 +83,7 @@ protected: //re-implemented widget event handlers void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent* event); + void mouseMoveEvent(QMouseEvent * event) override; private: