Details
-
Suggestion
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
None
-
None
Description
Perhaps I'm abusing the API slightly, but I have a use case for querying QTimer::remainingTime() from another thread, which currently doesn't work because the implementation doesn't pass thread() into QAbstractEventDispatcher::instance():
int QTimer::remainingTime() const { if (id != INV_TIMER) { return QAbstractEventDispatcher::instance()->remainingTime(id); } return -1; }
I'm currently doing a workaround like to get what I need:
if (my_timer.isActive()) return QAbstractEventDispatcher::instance(my_timer.thread())->remainingTime(my_timer_.timerId()); else return -1;
and I understand there are race-conditions here when called outside of the timer thread but as long as the user knows what they are doing and are ready to handle the -1 cases I think it would be useful for QTimer::remainingTime() to do this for us?