From 90c65ca19706f77c2b866ffb09b350419e2e5d64 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.5 6.2 5.15 Change-Id: I61b239647efe928eb0758cfc5649b33ab4d06c7d Reviewed-by: Edward Welbourne (cherry picked from commit 9e26f1da0b0dedf7ee6d860b7c11a27b0b554866) Reviewed-by: Qt Cherry-pick Bot --- 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 cd4cdf7d5e8..8b0ce0f6d5b 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -4694,9 +4694,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>=() */ @@ -4707,9 +4709,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==() */ @@ -4742,6 +4742,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==() */ @@ -4751,6 +4753,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==() */ @@ -4759,6 +4763,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==() */ @@ -4768,6 +4774,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==() */