diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-06-26 12:55:34 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-06-30 11:19:47 +0200 |
commit | e65a79a6e4898a19693eb5f65370f0f4c26db3f3 (patch) | |
tree | e40c1414695a0586e587a76c28995a1a12f2f5a2 /src | |
parent | a9b747e9848d03f29d551146597f6c85a6e0274e (diff) |
Enablers for QQuickWidget render() support.
Add a QImage based fallback for renderToTexture widgets, and use
that when rendering to something else than a QWidgetBackingStore.
Change-Id: I415a3a27c4ecb4ddbac45181c5a568b01ac5cb7a
Task-number: QTBUG-39562
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 311f9547a1..a1f3fbe8db 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5506,8 +5506,13 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP // This widget renders into a texture which is composed later. We just need to // punch a hole in the backingstore, so the texture will be visible. QPainter p(q); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.fillRect(q->rect(), Qt::transparent); + if (backingStore) { + p.setCompositionMode(QPainter::CompositionMode_Source); + p.fillRect(q->rect(), Qt::transparent); + } else { + // We are not drawing to a backingstore: fall back to QImage + p.drawImage(q->rect(), grabFramebuffer()); + } } else { //actually send the paint event QPaintEvent e(toBePainted); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 14831efca8..6520832943 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -627,7 +627,7 @@ public: #ifndef QT_NO_OPENGL virtual GLuint textureId() const { return 0; } - + virtual QImage grabFramebuffer() const { return QImage(); } void setRenderToTexture() { renderToTexture = true; setTextureChildSeen(); } void setTextureChildSeen() { |