Qobject::killtimer:timers cannot to stopped from another thread
This error occurs because some of the operations of the main thread object in the secondary thread are caused by
You can modify this
If the secondary thread needs to update the main thread object state, it needs to send a message, and the main thread object receives the processing without directly manipulating the thread
QT Timer is very good, just pay attention to cross threading issues
Considerations for using Timers:
1. QT Timer thread-related usage considerations:
1> can not boast thread start timer and stop timer
1> cannot boast a thread that initiates a timer-associated object, but releases (destructors) the object associated with the timer on another thread (the equivalent of 1> cannot stop the timer on other threads).
Qwarning ("Qobject::killtimers:timers cannot is stopped from another thread");
That is, timer-related logic and objects can only be used in one thread.
Because the QT timer has an internal data structure to correlate the timer-related logic.
Otherwise: The thread that starts the timer cannot delete the timer, and the timer associated with the object no longer exists, then the next timer event will crash.
Detailed principle is visible
The relationship between Qthread and Qobject