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
This commit is contained in:
Joe Taylor 2016-09-15 18:37:44 +00:00
parent f93c305ce2
commit fc8811176e
2 changed files with 21 additions and 0 deletions

View File

@ -34,6 +34,7 @@ FPlotter::FPlotter(QWidget *parent) : //FPlotter Constructor
m_ScalePixmap.fill(Qt::white); m_ScalePixmap.fill(Qt::white);
drawScale(); drawScale();
draw(); draw();
setMouseTracking(true);
} }
FPlotter::~FPlotter() { } // Destructor FPlotter::~FPlotter() { } // Destructor
@ -211,6 +212,24 @@ void FPlotter::draw() //draw()
update(); //trigger a new paintEvent 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 void FPlotter::mousePressEvent(QMouseEvent *event) //mousePressEvent
{ {
int x=event->x(); int x=event->x();

View File

@ -45,6 +45,7 @@ protected:
private slots: private slots:
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private: private:
@ -57,6 +58,7 @@ private:
QString m_HDivText[483]; QString m_HDivText[483];
QString m_t; QString m_t;
QString m_t0; QString m_t0;
QString m_t1;
double m_pixPerSecond; double m_pixPerSecond;