Replace deprecated QString member functions

This commit is contained in:
Bill Somerville 2021-03-17 00:09:02 +00:00
parent 75fbe1cb13
commit 0107901be9
No known key found for this signature in database
GPG Key ID: D864B06D1E81618F

View File

@ -7,6 +7,7 @@
#include <QPen> #include <QPen>
#include <QMouseEvent> #include <QMouseEvent>
#include <QDebug> #include <QDebug>
#include "qt_helpers.hpp"
#include "commons.h" #include "commons.h"
#include "moc_plotter.cpp" #include "moc_plotter.cpp"
#include <fstream> #include <fstream>
@ -247,23 +248,14 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
painter1.setPen(Qt::white); painter1.setPen(Qt::white);
QString t; QString t;
if(m_nUTC<0) { if(m_nUTC<0) {
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000; auto start = qt_truncate_date_time_to (QDateTime::currentDateTimeUtc(), m_TRperiod * 1e3)
int n = fmod(0.001*ms,m_TRperiod); .toString (m_TRperiod < 60. ? "hh:mm:ss" : "hh:mm");
QDateTime t1=QDateTime::currentDateTimeUtc().addSecs(-n); t = QString {"%1 %2"}.arg (start, m_rxBand);
if(m_TRperiod<60.0) {
t=t1.toString("hh:mm:ss") + " " + m_rxBand;
} else { } else {
t=t1.toString("hh:mm") + " " + m_rxBand; auto hr = m_nUTC / 10000;
} auto start = QTime {hr, (m_nUTC - 10000 * hr) / 100, m_nUTC % 100}
} else { .toString (m_TRperiod < 60. ? "hh:mm:ss" : "hh:mm");
int ih=m_nUTC/10000; t = QString {"%1 %2"}.arg (start).arg (m_rxBand);
int im=(m_nUTC - 10000*ih)/100;
int is=m_nUTC%100;
if(m_TRperiod<60) {
t.sprintf("%02d:%02d:%02d",ih,im,is) + " " + m_rxBand;
} else {
t.sprintf("%02d:%02d",ih,im) + " " + m_rxBand;
}
} }
painter1.drawText (5, painter1.fontMetrics ().ascent (), t); painter1.drawText (5, painter1.fontMetrics ().ascent (), t);
} }