aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-08-20 14:35:40 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-08-21 06:33:35 +0000
commitec022d0efec47e0e68cdec1c2e018ce864cc015c (patch)
tree4e98ce197a8a2e54c00638770485457656c80684
parent4b73fc5bd2fd3df10f1e7499c82da08fbd417055 (diff)
Port WorkerScript threading examples to use ES modules
This is the more modern way of doing things, so demonstrate that in our examples and documentation. Change-Id: Icd5316fbeeb00c34d470c8d871851945dc831244 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r--examples/quick/threading/doc/src/threading.qdoc4
-rw-r--r--examples/quick/threading/threadedlistmodel/dataloader.mjs (renamed from examples/quick/threading/threadedlistmodel/dataloader.js)0
-rw-r--r--examples/quick/threading/threadedlistmodel/timedisplay.qml2
-rw-r--r--examples/quick/threading/threading.qrc4
-rw-r--r--examples/quick/threading/workerscript/workerscript.mjs (renamed from examples/quick/threading/workerscript/workerscript.js)0
-rw-r--r--examples/quick/threading/workerscript/workerscript.qml2
-rw-r--r--src/qml/types/qqmllistmodel.cpp6
7 files changed, 9 insertions, 9 deletions
diff --git a/examples/quick/threading/doc/src/threading.qdoc b/examples/quick/threading/doc/src/threading.qdoc
index bbda638f07..f5e5139916 100644
--- a/examples/quick/threading/doc/src/threading.qdoc
+++ b/examples/quick/threading/doc/src/threading.qdoc
@@ -45,7 +45,7 @@
Inside the worker thread, the ListModel is synchronized once the data is
finished loading:
- \snippet threading/threadedlistmodel/dataloader.js 0
+ \snippet threading/threadedlistmodel/dataloader.mjs 0
\section1 WorkerScript
@@ -60,7 +60,7 @@
\snippet threading/workerscript/workerscript.qml 0
The workerscript then is free to take a really long time to calculate it:
- \snippet threading/workerscript/workerscript.js 0
+ \snippet threading/workerscript/workerscript.mjs 0
When it's done, the result returns to the main scene via the WorkerScript
type:
diff --git a/examples/quick/threading/threadedlistmodel/dataloader.js b/examples/quick/threading/threadedlistmodel/dataloader.mjs
index 86a4424dbc..86a4424dbc 100644
--- a/examples/quick/threading/threadedlistmodel/dataloader.js
+++ b/examples/quick/threading/threadedlistmodel/dataloader.mjs
diff --git a/examples/quick/threading/threadedlistmodel/timedisplay.qml b/examples/quick/threading/threadedlistmodel/timedisplay.qml
index cafb1be02e..5ad901c676 100644
--- a/examples/quick/threading/threadedlistmodel/timedisplay.qml
+++ b/examples/quick/threading/threadedlistmodel/timedisplay.qml
@@ -66,7 +66,7 @@ Rectangle {
WorkerScript {
id: worker
- source: "dataloader.js"
+ source: "dataloader.mjs"
}
// ![0]
diff --git a/examples/quick/threading/threading.qrc b/examples/quick/threading/threading.qrc
index 6d15b7ef71..5dc6dff443 100644
--- a/examples/quick/threading/threading.qrc
+++ b/examples/quick/threading/threading.qrc
@@ -2,9 +2,9 @@
<qresource prefix="/threading">
<file>threading.qml</file>
<file>threadedlistmodel/timedisplay.qml</file>
- <file>threadedlistmodel/dataloader.js</file>
+ <file>threadedlistmodel/dataloader.mjs</file>
<file>workerscript/Spinner.qml</file>
- <file>workerscript/workerscript.js</file>
+ <file>workerscript/workerscript.mjs</file>
<file>workerscript/workerscript.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/threading/workerscript/workerscript.js b/examples/quick/threading/workerscript/workerscript.mjs
index 9953958086..9953958086 100644
--- a/examples/quick/threading/workerscript/workerscript.js
+++ b/examples/quick/threading/workerscript/workerscript.mjs
diff --git a/examples/quick/threading/workerscript/workerscript.qml b/examples/quick/threading/workerscript/workerscript.qml
index 6c279d4a46..735cc8d1f1 100644
--- a/examples/quick/threading/workerscript/workerscript.qml
+++ b/examples/quick/threading/workerscript/workerscript.qml
@@ -56,7 +56,7 @@ Rectangle {
//! [1]
WorkerScript {
id: myWorker
- source: "workerscript.js"
+ source: "workerscript.mjs"
onMessage: {
if (messageObject.row == rowSpinner.value && messageObject.column == columnSpinner.value){ //Not an old result
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 282977e95e..7509a63777 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -1882,13 +1882,13 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index)
\snippet ../quick/threading/threadedlistmodel/timedisplay.qml 0
- The included file, \tt dataloader.js, looks like this:
+ The included file, \tt dataloader.mjs, looks like this:
- \snippet ../quick/threading/threadedlistmodel/dataloader.js 0
+ \snippet ../quick/threading/threadedlistmodel/dataloader.mjs 0
The timer in the main example sends messages to the worker script by calling
\l WorkerScript::sendMessage(). When this message is received,
- \c WorkerScript.onMessage() is invoked in \c dataloader.js,
+ \c WorkerScript.onMessage() is invoked in \c dataloader.mjs,
which appends the current time to the list model.
Note the call to sync() from the external thread.