From 392131feb48e84bfc4a98a714f305d17d8d5a75b Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 24 Jul 2023 10:16:59 +0200 Subject: [PATCH] Clarify QElapsedTimer::hasExpired()'s documentation The description in terms of timeouts was confusing. Instead, say what it actually does, in plain terms. Mention that you can do similar for a duration. Task-number: QTBUG-115447 Change-Id: I4618d7fa290e7959ed3cb51e5c2576b041f77091 Reviewed-by: Thiago Macieira (cherry picked from commit 669470e2be99dbeef2ec1b2083cf6a86c8c9d917) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/kernel/qelapsedtimer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qelapsedtimer.cpp b/src/corelib/kernel/qelapsedtimer.cpp index 66ae82811f7..b0a5c07179b 100644 --- a/src/corelib/kernel/qelapsedtimer.cpp +++ b/src/corelib/kernel/qelapsedtimer.cpp @@ -403,10 +403,12 @@ bool QElapsedTimer::isValid() const noexcept } /*! - Returns \c true if this QElapsedTimer has already expired by \a timeout - milliseconds (that is, more than \a timeout milliseconds have elapsed). - The value of \a timeout can be -1 to indicate that this timer does not - expire, in which case this function will always return false. + Returns \c true if elapsed() exceeds the given \a timeout, otherwise \c false. + + A negative \a timeout is interpreted as infinite, so \c false is returned in + this case. Otherwise, this is equivalent to \c {elapsed() > timeout}. You + can do the same for a duration by comparing durationElapsed() to a duration + timeout. \sa elapsed(), QDeadlineTimer */