From 4797cee661112b0e660b39656cee116f29b21d40 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 25 Apr 2016 23:12:59 +0000 Subject: [PATCH] Make time and band text position on waterfall font agnostic Use the actual font metrics to calculate the position rather than assuming the font size. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6648 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- plotter.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plotter.cpp b/plotter.cpp index 0c77f011c..504169f6a 100644 --- a/plotter.cpp +++ b/plotter.cpp @@ -109,7 +109,6 @@ void CPlotter::draw(float swide[], bool bScroll) //dr if(!painter2D.isActive()) return; QFont Font("Arial"); Font.setPointSize(12); - QFontMetrics metrics(Font); Font.setWeight(QFont::Normal); painter2D.setFont(Font); @@ -191,7 +190,7 @@ void CPlotter::draw(float swide[], bool bScroll) //dr if(swide[0]>1.0e29) m_line=0; m_line++; - if(m_line == 13) { + if(m_line == painter1.fontMetrics ().height ()) { painter1.setPen(Qt::white); QString t; if(m_TRperiod < 60) { @@ -202,7 +201,7 @@ void CPlotter::draw(float swide[], bool bScroll) //dr } else { t=QDateTime::currentDateTimeUtc().toString("hh:mm") + " " + m_rxBand; } - painter1.drawText(5,10,t); + painter1.drawText (5, painter1.fontMetrics ().ascent (), t); } if(m_mode=="JT4") { @@ -273,7 +272,6 @@ void CPlotter::DrawOverlay() //DrawOverlay() //create Font to use for scales QFont Font("Arial"); Font.setPointSize(12); - QFontMetrics metrics(Font); Font.setWeight(QFont::Normal); painter0.setFont(Font); painter0.setPen(Qt::black);