summaryrefslogtreecommitdiffstats
path: root/examples/3dstudioruntime2/simplewindow/main.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2018-05-18 10:33:28 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2018-05-18 10:33:34 +0200
commit8bb3378d0d7c82eb1896ac043570ddab7c2edae9 (patch)
treef3fe8bce8b4df108c1cc9766fdbafea95c3bd490 /examples/3dstudioruntime2/simplewindow/main.cpp
parent78ab305d5ca59a158232a8b47070ef35ae803033 (diff)
parent186e8bf9ec08b1aca289a23b93290bf4cd5521fe (diff)
Merge remote-tracking branch 'origin/2.0'
Diffstat (limited to 'examples/3dstudioruntime2/simplewindow/main.cpp')
-rw-r--r--examples/3dstudioruntime2/simplewindow/main.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/3dstudioruntime2/simplewindow/main.cpp b/examples/3dstudioruntime2/simplewindow/main.cpp
index 15796b4..3fea28b 100644
--- a/examples/3dstudioruntime2/simplewindow/main.cpp
+++ b/examples/3dstudioruntime2/simplewindow/main.cpp
@@ -80,13 +80,13 @@ int main(int argc, char *argv[])
});
// The presentation has a data input entry "di_text" for the textstring
- // property of one of the Text nodes. Provide a custom value.
+ // property of one of the Text nodes. Provide a custom value. Do this in a
+ // manner so that the value is set even when doing a Reload or changing the
+ // presentation object's source.
Q3DSDataInput dataInput(viewer.presentation(), QLatin1String("di_text"));
- // Assuming the source is never changed or reloaded, a plain setValue()
- // call is good enough. Otherwise, we would need to connect to the
- // presentationLoaded() signal and set the value whenever a new
- // presentation is loaded.
- dataInput.setValue(QLatin1String("Hello world"));
+ QObject::connect(&viewer, &Q3DSSurfaceViewer::presentationLoaded, &viewer, [&dataInput] {
+ dataInput.setValue(QLatin1String("Hello world"));
+ });
viewer.presentation()->setSource(QUrl(QLatin1String("qrc:/barrel.uip")));
viewer.create(&w, w.context());