【It is important to remember that a QThread instance lives in the old thread that instantiated it, not in the new thread that calls run(). This means that all of QThread's queued slots and invoked methods will execute in the old thread】. Thus, a developer who wishes to invoke slots in the new thread must use the worker-object approach; new slots should not be implemented directly into a subclassed QThread.
括号里这句是指两种模型都是这样?还是特指第二种模型?
应该是特指模型二,因为模型一不会去改写qthread。
Unlike queued slots or invoked methods, 【methods called directly on the QThread object will execute in the thread that calls the method. 】When subclassing QThread, keep in mind that the constructor executes in the old thread while run() executes in the new thread. If a member variable is accessed from both functions, then the variable is accessed from two different threads. Check that it is safe to do so.
括号里这句话到底是模型一还是模型二?
。
--
修改:zhanghaoX FROM 124.64.17.*
FROM 124.64.17.*