Using of QDeadlineTimer

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()}")
	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

So it turns out there is bug in PyQt5, not in PyQt6 or PySide2 and the solution is to use setRemainingTime()

deadline = QDeadlineTimer()