summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdatetimeedit.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-10-21 14:36:25 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-10-21 22:39:33 +0200
commit6e3b5801d26dc186066155202847342782bf653b (patch)
tree7d7662abbb71721be47dc206ca5cec05e15a89dd /src/widgets/widgets/qdatetimeedit.cpp
parent399f8151438408894f323927296b458f4fc0b27c (diff)
QDateTimeParser: always use locale for AM/PM texts
The default implementation used the locale, the reimplementation supported translating the texts. This mixing of l10n and i18n concepts resulted in bugs and inconsistencies. Using the texts for AM/PM from the locale that is set on the date/time control is sufficient. [ChangeLog][QtWidgets][QDateTimeParser] AM/PM strings in QDateTimeEdit and other classes using QDateTimeParser are provided by the locale, and are no longer translatable. Change-Id: I83a5dab470ae5ba35b3ce4040ad1877908f462c7 Fixes: QTBUG-75866 Task-number: QTBUG-72833 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/widgets/widgets/qdatetimeedit.cpp')
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index e26993fb23..f348bbed0e 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -2308,33 +2308,6 @@ void QDateTimeEdit::paintEvent(QPaintEvent *event)
style()->drawComplexControl(QStyle::CC_ComboBox, &optCombo, &p, this);
}
-/*
- Returns the string for AM and PM markers.
-
- If a translation for "AM" and "PM" is installed, then use that.
- Otherwise, use the default implementation, which uses the locale.
-*/
-QString QDateTimeEditPrivate::getAmPmText(AmPm ap, Case cs) const
-{
- QString original;
- QString translated;
- if (ap == AmText) {
- original = QLatin1String(cs == UpperCase ? "AM" : "am");
- translated = (cs == UpperCase ? QDateTimeParser::tr("AM") : QDateTimeParser::tr("am"));
- } else {
- original = QLatin1String(cs == UpperCase ? "PM" : "pm");
- translated = (cs == UpperCase ? QDateTimeParser::tr("PM") : QDateTimeParser::tr("pm"));
- }
-
- // This logic fails if a translation exists but doesn't change the string,
- // which we can accept as a corner-case for which a locale-derived answer
- // will be acceptable.
- if (original != translated)
- return translated;
-
- return QDateTimeParser::getAmPmText(ap, cs);
-}
-
int QDateTimeEditPrivate::absoluteIndex(QDateTimeEdit::Section s, int index) const
{
for (int i=0; i<sectionNodes.size(); ++i) {