From 25691764f99742fc2efed99b064f83f1ba70cc8c Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 7 May 2025 19:26:44 +0200 Subject: [PATCH] Gui: Show date & time in locale specific format --- src/Gui/Dialogs/DlgProjectInformationImp.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Gui/Dialogs/DlgProjectInformationImp.cpp b/src/Gui/Dialogs/DlgProjectInformationImp.cpp index 465c04106c..a242448d27 100644 --- a/src/Gui/Dialogs/DlgProjectInformationImp.cpp +++ b/src/Gui/Dialogs/DlgProjectInformationImp.cpp @@ -24,7 +24,9 @@ #ifndef _PreComp_ #include #include +#include #include +#include #include #endif @@ -71,15 +73,25 @@ DlgProjectInformationImp::DlgProjectInformationImp(App::Document* doc, , _doc(doc) , ui(new Ui_DlgProjectInformation) { + auto convertISODate = [](const char* isoDate) { + auto str = QString::fromUtf8(isoDate); + QDateTime dt = QDateTime::fromString(str, Qt::DateFormat::ISODate); + if (dt.isNull()) { + return str; + } + + QLocale loc = QLocale::system(); + return loc.toString(dt); + }; ui->setupUi(this); ui->lineEditName->setText(QString::fromUtf8(doc->Label.getValue())); ui->lineEditPath->setText(QString::fromUtf8(doc->FileName.getValue())); ui->lineEditUuid->setText(QString::fromUtf8(doc->Uid.getValueStr().c_str())); ui->lineEditProgramVersion->setText(QString::fromUtf8(doc->getProgramVersion())); ui->lineEditCreator->setText(QString::fromUtf8(doc->CreatedBy.getValue())); - ui->lineEditDate->setText(QString::fromUtf8(doc->CreationDate.getValue())); + ui->lineEditDate->setText(convertISODate(doc->CreationDate.getValue())); ui->lineEditLastMod->setText(QString::fromUtf8(doc->LastModifiedBy.getValue())); - ui->lineEditLastModDate->setText(QString::fromUtf8(doc->LastModifiedDate.getValue())); + ui->lineEditLastModDate->setText(convertISODate(doc->LastModifiedDate.getValue())); ui->lineEditCompany->setText(QString::fromUtf8(doc->Company.getValue())); // Load comboBox with unit systems