summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-22 09:39:48 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-22 10:00:43 -0700
commitfb1cf8d0e5b30794c6d2c5fd247f17fb4d63da08 (patch)
treed3e59bd55758a16f0669cfed8b1afccc59e3cfa8
parent757a4fa146484412a88a1911bf110a704eaafdec (diff)
downloadsubsurface-fb1cf8d0e5b30794c6d2c5fd247f17fb4d63da08.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
-rw-r--r--desktop-widgets/preferences/preferences_language.cpp4
1 files changed, 4 insertions, 0 deletions
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)