Fix initialization of QDateEdit and QTimeEdit
Since 6.3 these use Qt::UTC as time-spec but I neglected to take that into account in QDateTimeEditPrivate::init()'s construction of a QDateTime from the QDate or QTime. This amends commit c00ee2f31013e99c79b820a0db57003c110a5510. Fixes: QTBUG-105322 Change-Id: I11dec9808a54cf7da401b1734a9a2812f5fd2e63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 607c5a90c5c575be6ef7755d7e48e37dded2f74e) Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
parent
7af7683622
commit
09268a5702
@ -2480,7 +2480,7 @@ void QDateTimeEditPrivate::init(const QVariant &var)
|
||||
Q_Q(QDateTimeEdit);
|
||||
switch (var.userType()) {
|
||||
case QMetaType::QDate:
|
||||
value = var.toDate().startOfDay();
|
||||
value = var.toDate().startOfDay(spec);
|
||||
updateTimeSpec();
|
||||
q->setDisplayFormat(defaultDateFormat);
|
||||
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
|
||||
@ -2494,7 +2494,7 @@ void QDateTimeEditPrivate::init(const QVariant &var)
|
||||
q->setDisplayFormat("dd/MM/yyyy hh:mm:ss"_L1);
|
||||
break;
|
||||
case QMetaType::QTime:
|
||||
value = QDateTime(QDATETIMEEDIT_DATE_INITIAL, var.toTime());
|
||||
value = QDateTime(QDATETIMEEDIT_DATE_INITIAL, var.toTime(), spec);
|
||||
updateTimeSpec();
|
||||
q->setDisplayFormat(defaultTimeFormat);
|
||||
if (sectionNodes.isEmpty()) // ### safeguard for broken locale
|
||||
|
@ -536,7 +536,6 @@ void tst_QDateTimeEdit::constructor_qdate()
|
||||
{
|
||||
QDateEdit dte(parameter);
|
||||
dte.show();
|
||||
QEXPECT_FAIL("", "QTBUG-105322: constructors use wrong spec", Continue);
|
||||
QCOMPARE(dte.date(), displayDateTime.date());
|
||||
QCOMPARE(dte.minimumDate(), minimumDate);
|
||||
QCOMPARE(dte.minimumTime(), minimumTime);
|
||||
@ -588,7 +587,6 @@ void tst_QDateTimeEdit::constructor_qtime()
|
||||
{
|
||||
QTimeEdit dte(parameter);
|
||||
dte.show();
|
||||
QEXPECT_FAIL("", "QTBUG-105322: constructors use wrong spec", Abort);
|
||||
QCOMPARE(dte.time(), displayDateTime.time());
|
||||
QCOMPARE(dte.minimumDate(), minimumDate);
|
||||
QCOMPARE(dte.minimumTime(), minimumTime);
|
||||
|
Loading…
x
Reference in New Issue
Block a user