From 851b658298afb9bafeda98ffbfa2ade612c656be Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sun, 2 Jun 2019 22:17:11 +0200 Subject: New upstream version 2.1.0~rc6+repack --- models/FoxLog.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'models/FoxLog.cpp') diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp index 773a5308..debb08af 100644 --- a/models/FoxLog.cpp +++ b/models/FoxLog.cpp @@ -21,6 +21,23 @@ class FoxLog::impl final public: impl (Configuration const * configuration); + QVariant data (QModelIndex const& index, int role) const + { + auto value = QSqlTableModel::data (index, role); + if (index.column () == fieldIndex ("when") + && (Qt::DisplayRole == role || Qt::EditRole == role)) + { + auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC); + if (Qt::DisplayRole == role) + { + QLocale locale; + return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss"); + } + value = t; + } + return value; + } + Configuration const * configuration_; QSqlQuery mutable dupe_query_; QSqlQuery mutable export_query_; -- cgit v1.2.3