Let QDateTimeEdit control the century to use for two-digit years

Amends commit 41f84f3ddb780ec751e3fc706dd242fc4a99de7a - in which I
neglected QDTE. It just needs to set defaultCenturyStart to its old
initial year to match the prior behavior.

Fixes: QTBUG-126698
Task-number: QTBUG-46843
Change-Id: If1edafe25778ad064f8f4393c8b1b3bbf5c957dc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 130e066868634f4663b4640ee1923eece1c171b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2024-11-06 15:09:53 +01:00 committed by Qt Cherry-pick Bot
parent 9dc063e7de
commit 696daaf050

View File

@ -2536,6 +2536,7 @@ void QDateTimeEdit::initStyleOption(QStyleOptionSpinBox *option) const
void QDateTimeEditPrivate::init(const QVariant &var)
{
Q_Q(QDateTimeEdit);
defaultCenturyStart = QDATETIMEEDIT_DATE_INITIAL.year();
switch (var.userType()) {
case QMetaType::QDate:
value = var.toDate().startOfDay(timeZone);