From 9e26f1da0b0dedf7ee6d860b7c11a27b0b554866 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Fri, 29 Sep 2023 19:26:54 +0200 Subject: [PATCH] QDateTime: improve docs about invalid vs valid datetime relation Extract the information about the relation between invalid and valid datetimes into a snippet, and include it in the documentation of every relational operator. Pick-to: 6.6 6.5 6.2 5.15 Change-Id: I61b239647efe928eb0758cfc5649b33ab4d06c7d Reviewed-by: Edward Welbourne --- src/corelib/time/qdatetime.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 779fc1b0a5c..e59681ea341 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -4717,9 +4717,11 @@ bool QDateTime::equals(const QDateTime &other) const Returns \c true if \a lhs is the same as \a rhs; otherwise returns \c false. +//! [invalid-vs-valid-datetime] Two datetimes are different if either the date, the time, or the time zone - components are different. Since 5.14, all invalid datetime are equal (and + components are different. Since 5.14, all invalid datetimes are equal (and less than all valid datetimes). +//! [invalid-vs-valid-datetime] \sa operator!=(), operator<(), operator<=(), operator>(), operator>=() */ @@ -4730,9 +4732,7 @@ bool QDateTime::equals(const QDateTime &other) const Returns \c true if \a lhs is different from \a rhs; otherwise returns \c false. - Two datetimes are different if either the date, the time, or the time zone - components are different. Since 5.14, all invalid datetime are equal (and - less than all valid datetimes). + \include qdatetime.cpp invalid-vs-valid-datetime \sa operator==() */ @@ -4765,6 +4765,8 @@ bool QDateTime::precedes(const QDateTime &other) const Returns \c true if \a lhs is earlier than \a rhs; otherwise returns \c false. + \include qdatetime.cpp invalid-vs-valid-datetime + \sa operator==() */ @@ -4774,6 +4776,8 @@ bool QDateTime::precedes(const QDateTime &other) const Returns \c true if \a lhs is earlier than or equal to \a rhs; otherwise returns \c false. + \include qdatetime.cpp invalid-vs-valid-datetime + \sa operator==() */ @@ -4782,6 +4786,8 @@ bool QDateTime::precedes(const QDateTime &other) const Returns \c true if \a lhs is later than \a rhs; otherwise returns \c false. + \include qdatetime.cpp invalid-vs-valid-datetime + \sa operator==() */ @@ -4791,6 +4797,8 @@ bool QDateTime::precedes(const QDateTime &other) const Returns \c true if \a lhs is later than or equal to \a rhs; otherwise returns \c false. + \include qdatetime.cpp invalid-vs-valid-datetime + \sa operator==() */