diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-30 15:30:47 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-20 09:01:22 +0200 |
commit | bddafeb2e1f3bf45b85c28ffd175905a2dc62121 (patch) | |
tree | 2fa888eb56c92e2992453a8c35afeea40ad4789d /src/corelib/time | |
parent | 92d4d490fe808479e3fe8885e5e5cabd20f3d03f (diff) |
Turn comments about passing QDate, QTime by value into docs
This is already changed throughout qtbase, aside from template
specializations where passing by reference is required by the
template. Revise QDate and QTime documentation to say they are best
passed by value.
Change-Id: I0b05f42b273bf1fd4c412247a9372113b7e40561
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/time')
-rw-r--r-- | src/corelib/time/qdatetime.cpp | 14 | ||||
-rw-r--r-- | src/corelib/time/qdatetime.h | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index b6090047f0..167db2bb6a 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -344,11 +344,12 @@ static int fromOffsetString(QStringView offsetString, bool *valid) noexcept \reentrant \brief The QDate class provides date functions. - A QDate object represents a particular day, regardless of calendar, - locale or other settings used when creating it or supplied by the system. - It can report the year, month and day of the month that represent the - day with respect to the proleptic Gregorian calendar or any calendar supplied - as a QCalendar object. + A QDate object represents a particular day, regardless of calendar, locale + or other settings used when creating it or supplied by the system. It can + report the year, month and day of the month that represent the day with + respect to the proleptic Gregorian calendar or any calendar supplied as a + QCalendar object. QDate objects should be passed by value rather than by + reference to const; they simply package \c qint64. A QDate object is typically created by giving the year, month, and day numbers explicitly. Note that QDate interprets year numbers less than 100 as @@ -1655,7 +1656,8 @@ bool QDate::isLeapYear(int y) A QTime object contains a clock time, which it can express as the numbers of hours, minutes, seconds, and milliseconds since midnight. It provides functions for comparing times and for manipulating a time by adding a number - of milliseconds. + of milliseconds. QTime objects should be passed by value rather than by + reference to const; they simply package \c int. QTime uses the 24-hour clock format; it has no concept of AM/PM. Unlike QDateTime, QTime knows nothing about time zones or diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index fedc17c947..b3e978ebf3 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -60,7 +60,7 @@ class QTimeZone; #endif class QDateTime; -class Q_CORE_EXPORT QDate // ### Qt 6: change to be used by value, not const & +class Q_CORE_EXPORT QDate { explicit constexpr QDate(qint64 julianDay) : jd(julianDay) {} public: @@ -156,7 +156,7 @@ private: }; Q_DECLARE_TYPEINFO(QDate, Q_MOVABLE_TYPE); -class Q_CORE_EXPORT QTime // ### Qt 6: change to be used by value, not const & +class Q_CORE_EXPORT QTime { explicit constexpr QTime(int ms) : mds(ms) {} |