summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qdatetime.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-04-11 12:02:17 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-01-30 19:56:21 +0100
commit037369cc4d85c49e351c3df6544a398b61195656 (patch)
tree72679f5a745c6b057290f313545d7b279f62a96d /src/corelib/time/qdatetime.cpp
parent6a1df2d2060bfa346398f6125f33a4ff1b190a64 (diff)
Deprecate QDateTime(const QDate &) in favor of QDate::startOfDay()
It needed re-implemented in terms of the new API (in case QTime(0, 0) was skipped, on the date in question, by a spring-forwrd), which makes it redundant (and supports choice of spec and zone or offset, which it did not). Change-Id: I1e3c3e794632c234f254be754ed6e4ebdaaaa6bc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/time/qdatetime.cpp')
-rw-r--r--src/corelib/time/qdatetime.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index 80751e60a0..7cc8568bd5 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -3631,15 +3631,18 @@ QDateTime::QDateTime() noexcept(Data::CanBeSmall)
}
+#if QT_DEPRECATED_SINCE(5, 17) // ### Qt 6: remove
/*!
- Constructs a datetime with the given \a date, a valid
- time(00:00:00.000), and sets the timeSpec() to Qt::LocalTime.
-*/
+ Constructs a datetime with the given \a date, using Qt::LocalTime as the
+ timeSpec() and the time at the start of that date.
+ \sa QDate::startOfDay()
+*/
QDateTime::QDateTime(const QDate &date)
- : d(QDateTimePrivate::create(date, QTime(0, 0), Qt::LocalTime, 0))
+ : QDateTime(date.startOfDay(Qt::LocalTime, 0))
{
}
+#endif
/*!
Constructs a datetime with the given \a date and \a time, using