summaryrefslogtreecommitdiff
path: root/models/CabrilloLog.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-05-11 22:17:58 +0200
committerChristoph Berg <myon@debian.org>2020-05-11 22:17:58 +0200
commit32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (patch)
treec6e107c1ee4d70610e43a7912e57c720334a08c7 /models/CabrilloLog.cpp
parent08299e8b2bf50ba90daf570f57def529dd29d6e7 (diff)
New upstream version 2.2.0~rc1+repackupstream/2.2.0_rc1+repack
Diffstat (limited to 'models/CabrilloLog.cpp')
-rw-r--r--models/CabrilloLog.cpp17
1 files changed, 7 insertions, 10 deletions
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<Radio::Frequency> (), 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<Radio::Frequency> (), 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;