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:
parent
a9b747e984
commit
e65a79a6e4
@ -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
|
// 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.
|
// punch a hole in the backingstore, so the texture will be visible.
|
||||||
QPainter p(q);
|
QPainter p(q);
|
||||||
|
if (backingStore) {
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
p.fillRect(q->rect(), Qt::transparent);
|
p.fillRect(q->rect(), Qt::transparent);
|
||||||
|
} else {
|
||||||
|
// We are not drawing to a backingstore: fall back to QImage
|
||||||
|
p.drawImage(q->rect(), grabFramebuffer());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//actually send the paint event
|
//actually send the paint event
|
||||||
QPaintEvent e(toBePainted);
|
QPaintEvent e(toBePainted);
|
||||||
|
@ -627,7 +627,7 @@ public:
|
|||||||
|
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
virtual GLuint textureId() const { return 0; }
|
virtual GLuint textureId() const { return 0; }
|
||||||
|
virtual QImage grabFramebuffer() const { return QImage(); }
|
||||||
void setRenderToTexture() { renderToTexture = true; setTextureChildSeen(); }
|
void setRenderToTexture() { renderToTexture = true; setTextureChildSeen(); }
|
||||||
void setTextureChildSeen()
|
void setTextureChildSeen()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user