From fc8811176ecacfeeac9f84ef5aa563c3bda0473d Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 15 Sep 2016 18:37:44 +0000 Subject: [PATCH] Display cursor location (in seconds) on the Fast Graph. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7086 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- fastplot.cpp | 19 +++++++++++++++++++ fastplot.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/fastplot.cpp b/fastplot.cpp index 51e5be02e..52ddf65c1 100644 --- a/fastplot.cpp +++ b/fastplot.cpp @@ -34,6 +34,7 @@ FPlotter::FPlotter(QWidget *parent) : //FPlotter Constructor m_ScalePixmap.fill(Qt::white); drawScale(); draw(); + setMouseTracking(true); } FPlotter::~FPlotter() { } // Destructor @@ -211,6 +212,24 @@ void FPlotter::draw() //draw() update(); //trigger a new paintEvent } +void FPlotter::mouseMoveEvent(QMouseEvent *event) +{ + QPainter painter(&m_HorizPixmap); + int x=event->x(); +// int y=event->y(); + float t=x/m_pixPerSecond; + QString t1; + t1.sprintf("%4.1f",t); + if(m_t1.length()==4) { + painter.setPen(Qt::black); + painter.drawText (380,90,m_t1); + } + painter.setPen(Qt::yellow); + painter.drawText (380,90,t1); + update(); + m_t1=t1; +} + void FPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent { int x=event->x(); diff --git a/fastplot.h b/fastplot.h index 988015b01..e18c4d129 100644 --- a/fastplot.h +++ b/fastplot.h @@ -45,6 +45,7 @@ protected: private slots: void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); private: @@ -57,6 +58,7 @@ private: QString m_HDivText[483]; QString m_t; QString m_t0; + QString m_t1; double m_pixPerSecond;