Migrate away from deprecated Qt functions

`QString QDateTime::toString(Qt::DateFormat format = Qt::TextDate)` will
be removed in Qt6.
This commit is contained in:
Chocobo1
2021-01-06 12:47:18 +08:00
parent 89559eae2b
commit cede5ac9d2
5 changed files with 11 additions and 11 deletions

View File

@@ -155,7 +155,7 @@ LogMessageModel::LogMessageModel(QObject *parent)
void LogMessageModel::handleNewMessage(const Log::Msg &message)
{
const QString time = QDateTime::fromMSecsSinceEpoch(message.timestamp).toString(Qt::SystemLocaleShortDate);
const QString time = QLocale::system().toString(QDateTime::fromMSecsSinceEpoch(message.timestamp), QLocale::ShortFormat);
const QString messageText = message.message;
const QColor foreground = m_foregroundForMessageTypes[message.type];
@@ -173,7 +173,7 @@ LogPeerModel::LogPeerModel(QObject *parent)
void LogPeerModel::handleNewMessage(const Log::Peer &peer)
{
const QString time = QDateTime::fromMSecsSinceEpoch(peer.timestamp).toString(Qt::SystemLocaleShortDate);
const QString time = QLocale::system().toString(QDateTime::fromMSecsSinceEpoch(peer.timestamp), QLocale::ShortFormat);
const QString message = peer.blocked
? tr("%1 was blocked. Reason: %2.", "0.0.0.0 was blocked. Reason: reason for blocking.").arg(peer.ip, peer.reason)
: tr("%1 was banned", "0.0.0.0 was banned").arg(peer.ip);