diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index eb9d5a82fd..4ab1a9c995 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -2039,40 +2039,40 @@ int QTime::msecsTo(QTime t) const /*! - \fn bool QTime::operator==(QTime t) const + \fn bool QTime::operator==(QTime lhs, QTime rhs) - Returns \c true if this time is equal to \a t; otherwise returns \c false. + Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false. */ /*! - \fn bool QTime::operator!=(QTime t) const + \fn bool QTime::operator!=(QTime lhs, QTime rhs) - Returns \c true if this time is different from \a t; otherwise returns \c false. + Returns \c true if \a lhs is different from \a rhs; otherwise returns \c false. */ /*! - \fn bool QTime::operator<(QTime t) const + \fn bool QTime::operator<(QTime lhs, QTime rhs) - Returns \c true if this time is earlier than \a t; otherwise returns \c false. + Returns \c true if \a lhs is earlier than \a rhs; otherwise returns \c false. */ /*! - \fn bool QTime::operator<=(QTime t) const + \fn bool QTime::operator<=(QTime lhs, QTime rhs) - Returns \c true if this time is earlier than or equal to \a t; + Returns \c true if \a lhs is earlier than or equal to \a rhs; otherwise returns \c false. */ /*! - \fn bool QTime::operator>(QTime t) const + \fn bool QTime::operator>(QTime lhs, QTime rhs) - Returns \c true if this time is later than \a t; otherwise returns \c false. + Returns \c true if \a lhs is later than \a rhs; otherwise returns \c false. */ /*! - \fn bool QTime::operator>=(QTime t) const + \fn bool QTime::operator>=(QTime lhs, QTime rhs) - Returns \c true if this time is later than or equal to \a t; + Returns \c true if \a lhs is later than or equal to \a rhs; otherwise returns \c false. */ diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index e728a84385..e80a5b96d4 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -193,13 +193,6 @@ public: [[nodiscard]] QTime addMSecs(int ms) const; int msecsTo(QTime t) const; - constexpr bool operator==(QTime other) const { return mds == other.mds; } - constexpr bool operator!=(QTime other) const { return mds != other.mds; } - constexpr bool operator< (QTime other) const { return mds < other.mds; } - constexpr bool operator<=(QTime other) const { return mds <= other.mds; } - constexpr bool operator> (QTime other) const { return mds > other.mds; } - constexpr bool operator>=(QTime other) const { return mds >= other.mds; } - static constexpr inline QTime fromMSecsSinceStartOfDay(int msecs) { return QTime(msecs); } constexpr inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; } @@ -223,6 +216,13 @@ private: constexpr inline int ds() const { return mds == -1 ? 0 : mds; } int mds; + friend constexpr bool operator==(QTime lhs, QTime rhs) { return lhs.mds == rhs.mds; } + friend constexpr bool operator!=(QTime lhs, QTime rhs) { return lhs.mds != rhs.mds; } + friend constexpr bool operator< (QTime lhs, QTime rhs) { return lhs.mds < rhs.mds; } + friend constexpr bool operator<=(QTime lhs, QTime rhs) { return lhs.mds <= rhs.mds; } + friend constexpr bool operator> (QTime lhs, QTime rhs) { return lhs.mds > rhs.mds; } + friend constexpr bool operator>=(QTime lhs, QTime rhs) { return lhs.mds >= rhs.mds; } + friend class QDateTime; friend class QDateTimePrivate; #ifndef QT_NO_DATASTREAM