summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@digia.com>2014-06-26 12:55:34 +0200
committerLaszlo Agocs <laszlo.agocs@digia.com>2014-06-30 11:19:47 +0200
commite65a79a6e4898a19693eb5f65370f0f4c26db3f3 (patch)
treee40c1414695a0586e587a76c28995a1a12f2f5a2 /src
parenta9b747e9848d03f29d551146597f6c85a6e0274e (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.cpp9
-rw-r--r--src/widgets/kernel/qwidget_p.h2
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()
{