From 9cd486186e1e4e78f4f1b7e4a9142008a254c8cd Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 26 Mar 2015 21:34:42 +0100 Subject: QQuickWidget: expose the underlying QQuickWindow There's a number of APIs (such as all the scenegraph-related signals) that are currently missing from QQuickWidget. Instead of duplicating every API in QQuickWidget, simply expose the underlying offscreen QQuickWindow. Task-number: QTBUG-45260 Change-Id: I1a89fe600ce675963ea24ee6dd56d6ca4fea9cd2 Reviewed-by: Andy Shaw Reviewed-by: Gunnar Sletta Reviewed-by: Laszlo Agocs --- src/quickwidgets/qquickwidget.cpp | 19 +++++++++++++++++++ src/quickwidgets/qquickwidget.h | 2 ++ 2 files changed, 21 insertions(+) (limited to 'src/quickwidgets') diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index c4100551d0..b472664068 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -1218,4 +1218,23 @@ void QQuickWidget::setClearColor(const QColor &color) d->offscreenWindow->setColor(color); } +/*! + \since 5.5 + + Returns the offscreen QQuickWindow which is used by this widget to drive + the Qt Quick rendering. This is useful if you want to use QQuickWindow + APIs that are not currently exposed by QQuickWidget, for instance + connecting to the QQuickWindow::beforeRendering() signal in order + to draw native OpenGL content below Qt Quick's own rendering. + + \warning Use the return value of this function with caution. In + particular, do not ever attempt to show the QQuickWindow, and be + very careful when using other QWindow-only APIs. +*/ +QQuickWindow *QQuickWidget::quickWindow() const +{ + Q_D(const QQuickWidget); + return d->offscreenWindow; +} + QT_END_NAMESPACE diff --git a/src/quickwidgets/qquickwidget.h b/src/quickwidgets/qquickwidget.h index b961a6eeaf..a8bf03edfb 100644 --- a/src/quickwidgets/qquickwidget.h +++ b/src/quickwidgets/qquickwidget.h @@ -90,6 +90,8 @@ public: void setClearColor(const QColor &color); + QQuickWindow *quickWindow() const; + public Q_SLOTS: void setSource(const QUrl&); void setContent(const QUrl& url, QQmlComponent *component, QObject *item); -- cgit v1.2.3