summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grablyk <evgeny.grablyk@gmail.com>2013-05-28 14:08:41 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-30 13:59:27 +0200
commit30879a64cd4fccb99fe399a4d4c23de4f61b7d37 (patch)
tree866eb12a45cd88d4679edf052c50ca41a6ff84d5
parented279e4cf0036fe6839778dd21361e1bb9ccad94 (diff)
downloadqt3d-30879a64cd4fccb99fe399a4d4c23de4f61b7d37.tar.gz
Viewport: handle the situation when Scenegraph is already initialized.
Presently, Viewport waits for the QQuickWindow::sceneGraphInitialized() signal to initialize, which only fires once on application start. Viewports constructed later miss the signal and thus do not initialize. So we first check if QQuickWindow::openglContext() is not NULL, which indicates that the Scenegraph is ready, and initialize right away. Change-Id: Ib83479621ad8911896d1792aa807d39a517c1a49 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--src/imports/threed/viewport.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/imports/threed/viewport.cpp b/src/imports/threed/viewport.cpp
index 0ff23aef7..b8cb04bf8 100644
--- a/src/imports/threed/viewport.cpp
+++ b/src/imports/threed/viewport.cpp
@@ -1841,8 +1841,14 @@ void Viewport::itemChange(QQuickItem::ItemChange change, const ItemChangeData &v
d->directRenderInitialized = false;
if (d->canvas)
{
- connect(d->canvas, SIGNAL(sceneGraphInitialized()),
- this, SLOT(sceneGraphInitialized()), Qt::DirectConnection);
+ if (d->canvas->openglContext() != NULL)
+ {
+ sceneGraphInitialized();
+ } else {
+ connect(d->canvas, SIGNAL(sceneGraphInitialized()),
+ this, SLOT(sceneGraphInitialized()),
+ Qt::DirectConnection);
+ }
connect(d->canvas, SIGNAL(destroyed()),
this, SLOT(canvasDeleted()));
QSurfaceFormat format = d->canvas->format();