QDateTimeParser: mediate QLocale's meddling via a setter.
The former has (for now) nothing private, so QLocale got away with setting its .defaultLocale explicitly; provide a setter method by which it can do that, to allow scope for later encapsulation. Change-Id: I77fc5fc8f868fc7cf8d51eb1c5d18926c61cbf78 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
ee22fe13cd
commit
c671e66802
@ -218,6 +218,7 @@ public:
|
||||
|
||||
FieldInfo fieldInfo(int index) const;
|
||||
|
||||
void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; }
|
||||
virtual QDateTime getMinimum() const;
|
||||
virtual QDateTime getMaximum() const;
|
||||
virtual int cursorPosition() const { return -1; }
|
||||
|
@ -1834,7 +1834,7 @@ QTime QLocale::toTime(const QString &string, const QString &format) const
|
||||
QTime time;
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString);
|
||||
dt.defaultLocale = *this;
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, 0, &time);
|
||||
#else
|
||||
@ -1865,7 +1865,7 @@ QDate QLocale::toDate(const QString &string, const QString &format) const
|
||||
QDate date;
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString);
|
||||
dt.defaultLocale = *this;
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, &date, 0);
|
||||
#else
|
||||
@ -1898,7 +1898,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format) cons
|
||||
QDate date;
|
||||
|
||||
QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString);
|
||||
dt.defaultLocale = *this;
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
||||
return QDateTime(date, time);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user