diff options
Diffstat (limited to 'models/CabrilloLog.cpp')
| -rw-r--r-- | models/CabrilloLog.cpp | 17 |
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; |
