From 9dfc2aa75d930c6676f901e817bbc8c900a966f5 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 11 Apr 2019 12:35:12 +0200 Subject: Purge use of some deprecated methods from QDateTime tests QDateTime's short names setUtcOffset() and utcOffset() have been deprecated since 5.2, in favor of setOffsetFromUtc() and offsetFromUtc(). QDate's shortDayName() and shortMOnthName() have been deprecated since 5.10, in favor of QLocale's dayName() and monthName(). Also, the tests that were using them are testing methods only present when the datestring feature is enabled; so condition them on that feature. Change-Id: Ibfd4b132523ca8fbc1cb163353a44e0500877fd5 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools/qdatetime.h') diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 43271b34ed..8b2a60acaa 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -335,7 +335,7 @@ public: inline bool operator>(const QDateTime &other) const { return other < *this; } inline bool operator>=(const QDateTime &other) const { return !(*this < other); } -#if QT_DEPRECATED_SINCE(5, 2) +#if QT_DEPRECATED_SINCE(5, 2) // ### Qt 6: remove QT_DEPRECATED void setUtcOffset(int seconds); QT_DEPRECATED int utcOffset() const; #endif // QT_DEPRECATED_SINCE -- cgit v1.2.3 From 80853afd732aba126caa138ac421b036d2005f8d Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 23 Aug 2018 18:04:07 +0200 Subject: Add startOfDay() and endOfDay() methods to QDate These methods give the first and last QDateTime values in the given day, for a given time-zone or time-spec. These are usually the relevant midnight, or the millisecond before, except when time-zone transitions (typically DST changes) skip it, when care is needed to select the right moment. Adapted some code to make use of the new API, eliminating some old cruft from qdatetimeparser_p.h in the process. [ChangeLog][QtCore][QDate] Added startOfDay() and endOfDay() methods to provide a QDateTime at the start and end of a given date, taking account of any time skipped by transitions, e.g. a DST spring-forward, which can lead to a day starting at 01:00 or ending just before 23:00. Task-number: QTBUG-64485 Change-Id: I3dd7a34bedfbec8f8af00c43d13f50f99346ecd0 Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools/qdatetime.h') diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 51d5dd9759..8873651f17 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -55,6 +55,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSDate); QT_BEGIN_NAMESPACE class QTimeZone; +class QDateTime; class Q_CORE_EXPORT QDate { @@ -81,6 +82,13 @@ public: int daysInYear() const; int weekNumber(int *yearNum = nullptr) const; + QDateTime startOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const; + QDateTime endOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const; +#if QT_CONFIG(timezone) + QDateTime startOfDay(const QTimeZone &zone) const; + QDateTime endOfDay(const QTimeZone &zone) const; +#endif + #if QT_DEPRECATED_SINCE(5, 10) && QT_CONFIG(textdate) QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") static QString shortMonthName(int month, MonthNameType type = DateFormat); -- cgit v1.2.3 From b32b61f17eb6f816d854d6177e70df9c9e8fb895 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 30 Apr 2019 17:16:17 +0200 Subject: Remove handling of missing Q_COMPILER_RVALUE_REFS Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/tools/qdatetime.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/corelib/tools/qdatetime.h') diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 8873651f17..79fd25d762 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -278,9 +278,7 @@ public: QDateTime(QDateTime &&other) noexcept; ~QDateTime(); -#ifdef Q_COMPILER_RVALUE_REFS QDateTime &operator=(QDateTime &&other) noexcept { swap(other); return *this; } -#endif QDateTime &operator=(const QDateTime &other) noexcept; void swap(QDateTime &other) noexcept { qSwap(d.d, other.d.d); } -- cgit v1.2.3