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>
This commit is contained in:
Paul Olav Tvete 2014-06-26 12:55:34 +02:00 committed by Laszlo Agocs
parent a9b747e984
commit e65a79a6e4
2 changed files with 8 additions and 3 deletions

View File

@ -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);
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);

View File

@ -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()
{