From e6d1f08642eff25749b7e07c4e8589e4aa2513bf Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 19 Jun 2020 18:49:17 +0200 Subject: [PATCH] Drop use of Qt::DefaultLocaleShortDate Gone in Qt 6. Task-number: QTCREATORBUG-24098 Change-Id: Ie9fe1858406133fed6987de0e0a38fe86de15caf Reviewed-by: Eike Ziller --- src/plugins/coreplugin/coreplugin.cpp | 6 ++++-- src/plugins/git/gerrit/gerritmodel.cpp | 2 +- .../projectexplorer/customwizard/customwizardparameters.cpp | 4 ++-- src/plugins/vcsbase/cleandialog.cpp | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index bb63869fa8b..b2a61550777 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -180,9 +180,11 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) expander->registerVariable("CurrentTime:RFC", tr("The current time (RFC2822)."), []() { return QTime::currentTime().toString(Qt::RFC2822Date); }); expander->registerVariable("CurrentDate:Locale", tr("The current date (Locale)."), - []() { return QDate::currentDate().toString(Qt::DefaultLocaleShortDate); }); + []() { return QLocale::system() + .toString(QDate::currentDate(), QLocale::ShortFormat); }); expander->registerVariable("CurrentTime:Locale", tr("The current time (Locale)."), - []() { return QTime::currentTime().toString(Qt::DefaultLocaleShortDate); }); + []() { return QLocale::system() + .toString(QTime::currentTime(), QLocale::ShortFormat); }); expander->registerVariable("Config:DefaultProjectDirectory", tr("The configured default directory for projects."), []() { return DocumentManager::projectsDirectory().toString(); }); expander->registerVariable("Config:LastFileDialogDirectory", tr("The directory last visited in a file dialog."), diff --git a/src/plugins/git/gerrit/gerritmodel.cpp b/src/plugins/git/gerrit/gerritmodel.cpp index c5e346aaa6e..a4e2ae8e1eb 100644 --- a/src/plugins/git/gerrit/gerritmodel.cpp +++ b/src/plugins/git/gerrit/gerritmodel.cpp @@ -466,7 +466,7 @@ QString GerritModel::toHtml(const QModelIndex& index) const << dependencyHtml(dependsOnHeader, c->dependsOnNumber, serverPrefix) << dependencyHtml(neededByHeader, c->neededByNumber, serverPrefix) << "" << statusHeader << "" << c->status - << ", " << c->lastUpdated.toString(Qt::DefaultLocaleShortDate) << "" + << ", " << QLocale::system().toString(c->lastUpdated, QLocale::ShortFormat) << "" << "" << patchSetHeader << "" << "" << c->currentPatchSet.patchSetNumber << "" << c->currentPatchSet.approvalsToHtml() << "" << urlHeader << "url << "\">" << c->url << "" diff --git a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp index 323c0d6100e..da071f11922 100644 --- a/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp +++ b/src/plugins/projectexplorer/customwizard/customwizardparameters.cpp @@ -922,9 +922,9 @@ void CustomWizardContext::reset() baseReplacements.insert(QLatin1String("CurrentTime:RFC"), currentTime.toString(Qt::RFC2822Date)); baseReplacements.insert(QLatin1String("CurrentDate:Locale"), - currentDate.toString(Qt::DefaultLocaleShortDate)); + QLocale::system().toString(currentDate, QLocale::ShortFormat)); baseReplacements.insert(QLatin1String("CurrentTime:Locale"), - currentTime.toString(Qt::DefaultLocaleShortDate)); + QLocale::system().toString(currentTime, QLocale::ShortFormat)); replacements.clear(); path.clear(); targetPath.clear(); diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp index 0f358ab1de0..46f3acb0212 100644 --- a/src/plugins/vcsbase/cleandialog.cpp +++ b/src/plugins/vcsbase/cleandialog.cpp @@ -211,7 +211,8 @@ void CleanDialog::addFile(const QString &workingDirectory, QString fileName, boo nameItem->setData(QVariant(isDir), Internal::isDirectoryRole); // Tooltip with size information if (fi.isFile()) { - const QString lastModified = fi.lastModified().toString(Qt::DefaultLocaleShortDate); + const QString lastModified = + QLocale::system().toString(fi.lastModified(), QLocale::ShortFormat); nameItem->setToolTip(tr("%n bytes, last modified %1.", nullptr, fi.size()).arg(lastModified)); }