From 2a653fde48f7312ccd2f792d72d305061b410ae3 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 28 Nov 2019 14:22:09 +0100 Subject: Convert date-time faithfully in QDateTimeEdit::setDateTime() Previously, setDateTime() was documented to ignore the new date-time's time-spec. It used the date and time (determined using that timespec) with the QDateTimeEdit's configured spec. It is debatable whether that really counts as ignoring its time-spec. All the same, that's what it did. Fixing it is a behavior change. Added tests. [ChangeLog][QtWidgets][QDateTimeEdit] QDateTimeEdit::setDateTime() now converts the new datetime to the QDateTimeEdit's time-spec, rather than combining its date and time (determined using the time spec it came with) with the QDateTimeEdit's date and time. Fixes: QTBUG-71181 Change-Id: Ibf0bd87723c3957ca00a2199d51d992032ef57ee Reviewed-by: Paul Wicking Reviewed-by: Volker Hilsheimer Reviewed-by: Konstantin Shegunov --- src/widgets/widgets/qdatetimeedit_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/widgets/widgets/qdatetimeedit_p.h') diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h index 392bb0c778..0a4433846f 100644 --- a/src/widgets/widgets/qdatetimeedit_p.h +++ b/src/widgets/widgets/qdatetimeedit_p.h @@ -109,6 +109,7 @@ public: void updateCache(const QVariant &val, const QString &str) const; + QDateTime convertTimeSpec(const QDateTime &datetime); void updateTimeSpec(); QString valueToText(const QVariant &var) const { return textFromValue(var); } -- cgit v1.2.3