refactor: Replace deprecated Qt::SystemLocale{Short,Long}Date

This commit is contained in:
Hennadii Stepanov 2020-11-26 18:58:47 +02:00
parent 50091592dd
commit 86b1ab64b1
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 4 additions and 2 deletions

View file

@ -11,6 +11,7 @@
#include <QDateTime> #include <QDateTime>
#include <QList> #include <QList>
#include <QLocale>
#include <QModelIndex> #include <QModelIndex>
#include <QVariant> #include <QVariant>
@ -122,7 +123,7 @@ QVariant BanTableModel::data(const QModelIndex &index, int role) const
case Bantime: case Bantime:
QDateTime date = QDateTime::fromMSecsSinceEpoch(0); QDateTime date = QDateTime::fromMSecsSinceEpoch(0);
date = date.addSecs(rec->banEntry.nBanUntil); date = date.addSecs(rec->banEntry.nBanUntil);
return date.toString(Qt::SystemLocaleLongDate); return QLocale::system().toString(date, QLocale::LongFormat);
} }
} }

View file

@ -43,6 +43,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QLineEdit> #include <QLineEdit>
#include <QList> #include <QList>
#include <QLocale>
#include <QMenu> #include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QProgressDialog> #include <QProgressDialog>
@ -67,7 +68,7 @@ namespace GUIUtil {
QString dateTimeStr(const QDateTime &date) QString dateTimeStr(const QDateTime &date)
{ {
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm"); return QLocale::system().toString(date.date(), QLocale::ShortFormat) + QString(" ") + date.toString("hh:mm");
} }
QString dateTimeStr(qint64 nTime) QString dateTimeStr(qint64 nTime)