summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp b/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
index fde37bb549..5c6055defe 100644
--- a/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_thread_qthread.cpp
@@ -47,7 +47,7 @@ class WorkerThread : public QThread
Q_OBJECT
void run() Q_DECL_OVERRIDE {
QString result;
- /* expensive or blocking operation */
+ /* ... here is the expensive or blocking operation ... */
emit resultReady(result);
}
signals:
@@ -71,7 +71,8 @@ class Worker : public QObject
public slots:
void doWork(const QString &parameter) {
- // ...
+ QString result;
+ /* ... here is the expensive or blocking operation ... */
emit resultReady(result);
}
@@ -87,7 +88,7 @@ public:
Controller() {
Worker *worker = new Worker;
worker->moveToThread(&workerThread);
- connect(workerThread, &QThread::finished, worker, &QObject::deleteLater);
+ connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
connect(this, &Controller::operate, worker, &Worker::doWork);
connect(worker, &Worker::resultReady, this, &Controller::handleResults);
workerThread.start();