Display cursor position on Wide graph as a ToolTip.

This commit is contained in:
Joe Taylor 2020-07-24 13:35:04 -04:00
parent dbaffea0cd
commit 5c4878a00a
2 changed files with 10 additions and 0 deletions

View File

@ -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") {

View File

@ -13,6 +13,7 @@
#include <QImage>
#include <QVector>
#include <QColor>
#include <QToolTip>
#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;