return d->window;
}
+/*!
+ \fn QWindow *QQuickRenderControl::renderWindow(QPoint *offset)
+
+ Reimplemented in subclasses to return the real window this render control
+ is rendering into.
+
+ If \a offset in non-null, it is set to the offset of the control
+ inside the window.
+*/
+
+/*!
+ Returns the real window that \a win is being rendered to, if any.
+
+ If \a offset in non-null, it is set to the offset of the rendering
+ inside its window.
+
+ */
+
+QWindow *QQuickRenderControl::renderWindowFor(QQuickWindow *win, QPoint *offset)
+{
+ if (!win)
+ return 0;
+ QQuickRenderControl *rc = QQuickWindowPrivate::get(win)->renderControl;
+ if (rc)
+ return rc->renderWindow(offset);
+ return 0;
+}
+
+
+
QT_END_NAMESPACE
extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
+class QQuickWidgetRenderControl : public QQuickRenderControl
+{
+public:
+ QQuickWidgetRenderControl(QQuickWidget *quickwidget) : m_quickWidget(quickwidget) {}
+ QWindow *renderWindow(QPoint *offset) {
+ if (offset)
+ *offset = m_quickWidget->mapTo(m_quickWidget->window(), QPoint());
+ return m_quickWidget->window()->windowHandle();
+ }
+private:
+ QQuickWidget *m_quickWidget;
+};
+
void QQuickWidgetPrivate::init(QQmlEngine* e)
{
Q_Q(QQuickWidget);
+ renderControl = new QQuickWidgetRenderControl(q);
+ offscreenWindow = new QQuickWindow(renderControl);
+ offscreenWindow->setTitle(QString::fromLatin1("Offscreen"));
+ // Do not call create() on offscreenWindow.
+ createOffscreenSurface();
+
setRenderToTexture();
engine = e;
, updatePending(false)
, fakeHidden(false)
{
- renderControl = new QQuickRenderControl;
- offscreenWindow = new QQuickWindow(renderControl);
- offscreenWindow->setTitle(QString::fromLatin1("Offscreen"));
- // Do not call create() on offscreenWindow.
- createOffscreenSurface();
}
QQuickWidgetPrivate::~QQuickWidgetPrivate()