的finished()
信号是否QFutureWatcher
总是会被触发,即使 代表的并发作业在附加到QFuture
之前已经完成?QFutureWatcher
QFuture
考虑以下示例:
// Start some computation.
QFuture<int> future = QtConcurrent::run(...);
// [A] At this point some time may pass where the computation might finish concurrently
// Instaciate watcher
QFutureWatcher<int> watcher;
// Instantiate an object to receive singal
MyClass myObject;
// Connect slot to watcher's finished() signal
connect(&watcher, SIGNAL(finished()), &myObject, SLOT(handleFinished()));
// Attach watcher to the future
watcher.setFuture(future);
// [B] Will the handleFinished() slot be called at this point even if the concurrent job already completed in point [A] above?
而且,最重要的是,如果没有发生这种情况,handleFinished()
在这种情况下如何让插槽始终被调用?