From 32a41b1abe1a4aab0892c9c2051be6ba5b379f1e Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Mon, 11 May 2020 22:17:58 +0200 Subject: New upstream version 2.2.0~rc1+repack --- models/CabrilloLog.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'models/CabrilloLog.cpp') diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp index dfba3d43..b0459e19 100644 --- a/models/CabrilloLog.cpp +++ b/models/CabrilloLog.cpp @@ -50,20 +50,17 @@ public: else { value = QSqlTableModel::data (model_index, role); - if (model_index.column () == fieldIndex ("frequency") && Qt::DisplayRole == role) + if (Qt::DisplayRole == role) { - value = Radio::frequency_MHz_string (value.value (), 3); // kHz precision - } - else if (model_index.column () == fieldIndex ("when") - && (Qt::DisplayRole == role || Qt::EditRole == role)) - { // adjust date/time to Qt format - auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC); - if (Qt::DisplayRole == role) + if (model_index.column () == fieldIndex ("frequency")) { + value = Radio::frequency_MHz_string (value.value (), 3); // kHz precision + } + else if (model_index.column () == fieldIndex ("when")) + { // adjust date/time to Qt format QLocale locale; - return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); + value = locale.toString (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC), locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); } - value = t; } } return value; -- cgit v1.2.3