diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-10-23 14:45:51 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-11-07 06:25:09 +0100 |
commit | c81893907ec7134826cb9fb64507e74aeb671c4e (patch) | |
tree | 990f221b417e757880e4678a905bf22738998327 /src | |
parent | 6206c6c189407f2d38fae921f3620a1c2a6f8d72 (diff) |
Make QTime's operators hidden friends
Update docs to match.
Change-Id: Ibcaeaea04fa552c392d49e711201719f99733742
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/time/qdatetime.cpp | 24 | ||||
-rw-r--r-- | src/corelib/time/qdatetime.h | 14 |
2 files changed, 19 insertions, 19 deletions
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 |