Tidy up a bit in QTZP_p.h

The ICU backend was using its base's displayName() but none of the
other backends did so; have them do the same. This saves the need for
a QTZP:: suffix one one call to the UTC backend's displayName().

The order of backends in the header is a jumbled mess and the set of
could surely be reduced to a #if...#elif...#endif chain, especially
once TZ's dependence on ICU is sorted out, so add a TODO about that.

Change-Id: I6d6daf3f899f7c79538a7d16bc94b0610f1a4c28
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2024-02-26 16:18:46 +01:00
parent dd56558ecd
commit d06cff0859
2 changed files with 10 additions and 2 deletions

View File

@ -908,7 +908,7 @@ QString QTimeZone::displayName(const QDateTime &atDateTime, NameType nameType,
return systemTimeZone().displayName(atDateTime, nameType, locale);
case Qt::UTC:
case Qt::OffsetFromUTC:
return QUtcTimeZonePrivate(d.s.offset).QTimeZonePrivate::displayName(
return QUtcTimeZonePrivate(d.s.offset).displayName(
atDateTime.toMSecsSinceEpoch(), nameType, locale);
case Qt::TimeZone:
Q_UNREACHABLE();

View File

@ -183,6 +183,7 @@ public:
QLocale::Territory territory() const override;
QString comment() const override;
using QTimeZonePrivate::displayName;
QString displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const override;
@ -213,6 +214,9 @@ private:
int m_offsetFromUtc;
};
// TODO: shuffle (almost reverse) order of and rework #if-ery here to use #elif
// and match the #if-ery in each of QTZ's newBackendTimeZone() cascades for
// backend selection.
#if QT_CONFIG(icu)
class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate final : public QTimeZonePrivate
{
@ -255,7 +259,7 @@ private:
UCalendar *m_ucal;
};
#endif
#endif // ICU
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID)
struct QTzTransitionTime
@ -303,6 +307,7 @@ public:
QLocale::Territory territory() const override;
QString comment() const override;
using QTimeZonePrivate::displayName;
QString displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
const QLocale &locale) const override;
@ -361,6 +366,7 @@ public:
QString comment() const override;
using QTimeZonePrivate::displayName;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
const QLocale &locale) const override;
QString abbreviation(qint64 atMSecsSinceEpoch) const override;
@ -414,6 +420,7 @@ public:
QString comment() const override;
using QTimeZonePrivate::displayName;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
const QLocale &locale) const override;
QString abbreviation(qint64 atMSecsSinceEpoch) const override;
@ -462,6 +469,7 @@ public:
QAndroidTimeZonePrivate *clone() const override;
using QTimeZonePrivate::displayName;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
const QLocale &locale) const override;
QString abbreviation(qint64 atMSecsSinceEpoch) const override;