QTime: use new comparison helper macros

The unit-tests were already ported to the new comparison helper
functions from QTestPrivate.

Task-number: QTBUG-104111
Change-Id: I23267fd457547b2705e821e7666130f5f9c019d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Ivan Solovev 2023-05-23 12:56:23 +02:00
parent a6f4e55b4d
commit ff04c24184
2 changed files with 12 additions and 12 deletions

View File

@ -2236,38 +2236,38 @@ int QTime::msecsTo(QTime t) const
/*! /*!
\fn bool QTime::operator==(QTime lhs, QTime rhs) \fn bool QTime::operator==(const QTime &lhs, const QTime &rhs)
Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false. Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.
*/ */
/*! /*!
\fn bool QTime::operator!=(QTime lhs, QTime rhs) \fn bool QTime::operator!=(const QTime &lhs, const QTime &rhs)
Returns \c true if \a lhs is different from \a rhs; otherwise returns \c false. Returns \c true if \a lhs is different from \a rhs; otherwise returns \c false.
*/ */
/*! /*!
\fn bool QTime::operator<(QTime lhs, QTime rhs) \fn bool QTime::operator<(const QTime &lhs, const QTime &rhs)
Returns \c true if \a lhs is earlier than \a rhs; otherwise returns \c false. Returns \c true if \a lhs is earlier than \a rhs; otherwise returns \c false.
*/ */
/*! /*!
\fn bool QTime::operator<=(QTime lhs, QTime rhs) \fn bool QTime::operator<=(const QTime &lhs, const QTime &rhs)
Returns \c true if \a lhs is earlier than or equal to \a rhs; Returns \c true if \a lhs is earlier than or equal to \a rhs;
otherwise returns \c false. otherwise returns \c false.
*/ */
/*! /*!
\fn bool QTime::operator>(QTime lhs, QTime rhs) \fn bool QTime::operator>(const QTime &lhs, const QTime &rhs)
Returns \c true if \a lhs is later than \a rhs; otherwise returns \c false. Returns \c true if \a lhs is later than \a rhs; otherwise returns \c false.
*/ */
/*! /*!
\fn bool QTime::operator>=(QTime lhs, QTime rhs) \fn bool QTime::operator>=(const QTime &lhs, const QTime &rhs)
Returns \c true if \a lhs is later than or equal to \a rhs; Returns \c true if \a lhs is later than or equal to \a rhs;
otherwise returns \c false. otherwise returns \c false.

View File

@ -235,12 +235,12 @@ private:
constexpr inline int ds() const { return mds == -1 ? 0 : mds; } constexpr inline int ds() const { return mds == -1 ? 0 : mds; }
int mds; int mds;
friend constexpr bool operator==(QTime lhs, QTime rhs) { return lhs.mds == rhs.mds; } friend constexpr bool comparesEqual(const QTime &lhs, const QTime &rhs) noexcept
friend constexpr bool operator!=(QTime lhs, QTime rhs) { return lhs.mds != rhs.mds; } { return lhs.mds == rhs.mds; }
friend constexpr bool operator< (QTime lhs, QTime rhs) { return lhs.mds < rhs.mds; } friend constexpr Qt::strong_ordering
friend constexpr bool operator<=(QTime lhs, QTime rhs) { return lhs.mds <= rhs.mds; } compareThreeWay(const QTime &lhs, const QTime &rhs) noexcept
friend constexpr bool operator> (QTime lhs, QTime rhs) { return lhs.mds > rhs.mds; } { return Qt::compareThreeWay(lhs.mds, rhs.mds); }
friend constexpr bool operator>=(QTime lhs, QTime rhs) { return lhs.mds >= rhs.mds; } Q_DECLARE_STRONGLY_ORDERED_LITERAL_TYPE(QTime)
friend class QDateTime; friend class QDateTime;
friend class QDateTimePrivate; friend class QDateTimePrivate;