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>
This commit is contained in:
Edward Welbourne 2020-07-30 15:30:47 +02:00
parent 92d4d490fe
commit bddafeb2e1
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -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)
{}