diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-17 11:46:38 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-17 14:11:13 +0200 |
commit | 4096d0192363bdc031ab2d13bed5b3a4b109f255 (patch) | |
tree | b36783fb5963acb89d3d6cf58e3a9bf707731853 | |
parent | b1243d7a64bd337cfc1b277b4b0bd587297e5da6 (diff) |
Add methods for finding out if scene graph context has been initialized
We cannot rely on the OpenGL context for that as there may be
non-OpenGL scene graphs. In order for those to announce their readiness
QSGRenderContext::isValid() has to be virtual.
Change-Id: Ica35d8590e3f06edb54d57d93898d52e753f0407
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 9 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 6c6b343080..ca0a81f2f4 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -2926,6 +2926,15 @@ QOpenGLContext *QQuickWindow::openglContext() const } /*! + Returns true if the scene graph has been initialized; otherwise returns false. + */ +bool QQuickWindow::isSceneGraphInitialized() const +{ + Q_D(const QQuickWindow); + return d->context != 0 && d->context->isValid(); +} + +/*! \fn void QQuickWindow::frameSwapped() This signal is emitted when the frame buffers have been swapped. diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index 108bcec589..82f2e29d9d 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -139,6 +139,7 @@ public: bool isPersistentSceneGraph() const; QOpenGLContext *openglContext() const; + bool isSceneGraphInitialized() const; void scheduleRenderJob(QRunnable *job, RenderStage schedule); diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index 184b8248d5..91788d82d4 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -93,7 +93,7 @@ public: QOpenGLContext *openglContext() const { return m_gl; } QSGContext *sceneGraphContext() const { return m_sg; } - bool isValid() const { return m_gl; } + virtual bool isValid() const { return m_gl; } virtual void initialize(QOpenGLContext *context); virtual void invalidate(); |