summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-29 11:20:24 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-29 13:34:31 +0200
commita690022b7e56b2e36a95ef22b854af4c82c5fdc8 (patch)
tree0d44f2d2a4693b76ec203339ce7db8ee423bd179
parenta9790627873d17f91f29c9bd8be0fb609ec29f03 (diff)
Qt Designer: Enable editing of current dates
Qt Designer uses QLocale::ShortFormat for its date editor, which has a 2 digit year. This causes the year to expanded to the wrong year (99->1999) for the maximum value and other issues. Fix by making the year 4 digits. Change-Id: I6cb73c5027f340706f44cd5fe3bfec5e90facb46 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r--src/shared/qtpropertybrowser/qtpropertybrowserutils.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/qtpropertybrowser/qtpropertybrowserutils.cpp b/src/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
index 0840176dc..9602b10d0 100644
--- a/src/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
+++ b/src/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
@@ -214,7 +214,11 @@ QString QtPropertyBrowserUtils::fontValueText(const QFont &f)
QString QtPropertyBrowserUtils::dateFormat()
{
QLocale loc;
- return loc.dateFormat(QLocale::ShortFormat);
+ QString format = loc.dateFormat(QLocale::ShortFormat);
+ // Change dd.MM.yy, MM/dd/yy to 4 digit years
+ if (format.count(QLatin1Char('y')) == 2)
+ format.insert(format.indexOf(QLatin1Char('y')), QLatin1String("yy"));
+ return format;
}
QString QtPropertyBrowserUtils::timeFormat()