I guess this is a bit of a deviation from the main stream GUI domain, however I need to create some accurate delays so wanted to get my head around QDeadlineTimer. So created the following test code, called from within a button press.
def try_some_delays(self):
"""
To try some delays in the main thread.
"""
deadline = QDeadlineTimer(10000)
print(f"deadline.remainingTime(): {deadline.remainingTime()}")
print(f"has expired: {deadline.hasExpired()}")
sleep(0.5)
print(f"deadline.remainingTime(): {deadline.remainingTime()}")
print(f"deadline.remainingTimeNSecs(): {deadline.remainingTimeNSecs()}")
In all cases deadline.remainingTime() returns 0 and deadline.hasExpired() returns True.
Ultimately I’ll be using QDeadlineTimer from within a QRunner or QThread, but I just want to understand how it works, which I obviously don’t! currently