From fb1cf8d0e5b30794c6d2c5fd247f17fb4d63da08 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 22 May 2020 09:39:48 +0200 Subject: [PATCH] desktop: refresh date/time format when switching to system defaults When switching to system defaults, refresh the fields in the preferences UI so that the user can tell how the fields will be formatted. Signed-off-by: Berthold Stoeger --- desktop-widgets/preferences/preferences_language.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp index 445970c27..f2519ef2c 100644 --- a/desktop-widgets/preferences/preferences_language.cpp +++ b/desktop-widgets/preferences/preferences_language.cpp @@ -90,6 +90,10 @@ void PreferencesLanguage::syncSettings() qPrefLanguage::set_date_format_short(ui->shortDateFormatEntry->text()); initUiLanguage(); + // When switching to system defaults, initUiLanguage() will reset the date and time formats. + // Therefore, refresh the UI fields to give the user a visual feedback of the new formats. + refreshSettings(); + QString qDateTimeWeb = tr("These will be used as is. This might not be what you intended.\nSee http://doc.qt.io/qt-5/qdatetime.html#toString"); QRegExp tfillegalchars("[^hHmszaApPt\\s:;\\.,]"); if (tfillegalchars.indexIn(ui->timeFormatEntry->currentText()) >= 0)