Render QOpenGLWidget/QQuickWidget with AlwaysStackOnTop
QWidget::render was ignoring QOpenGLWidget/QQuickWidget with AlwaysStackOnTop set, because normally they will be composited later, however when not doing a backing store render, they need to be painted right away as there is no later. Task-number: QTBUG-67533 Change-Id: I08e2eeee5e7a8f0dbbf43f659fcfa9068e8c46d1 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
7e2177464f
commit
0a63d5fed6
@ -5593,21 +5593,23 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
|
|||||||
if (renderToTexture) {
|
if (renderToTexture) {
|
||||||
// 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.
|
||||||
if (!q->testAttribute(Qt::WA_AlwaysStackOnTop)) {
|
|
||||||
beginBackingStorePainting();
|
beginBackingStorePainting();
|
||||||
if (backingStore) {
|
if (!q->testAttribute(Qt::WA_AlwaysStackOnTop) && backingStore) {
|
||||||
QPainter p(q);
|
QPainter p(q);
|
||||||
p.setCompositionMode(QPainter::CompositionMode_Source);
|
p.setCompositionMode(QPainter::CompositionMode_Source);
|
||||||
p.fillRect(q->rect(), Qt::transparent);
|
p.fillRect(q->rect(), Qt::transparent);
|
||||||
} else {
|
} else if (!backingStore) {
|
||||||
QImage img = grabFramebuffer();
|
|
||||||
QPainter p(q);
|
|
||||||
// We are not drawing to a backingstore: fall back to QImage
|
// We are not drawing to a backingstore: fall back to QImage
|
||||||
|
QImage img = grabFramebuffer();
|
||||||
|
// grabFramebuffer() always sets the format to RGB32
|
||||||
|
// regardless of whether it is transparent or not.
|
||||||
|
if (img.format() == QImage::Format_RGB32)
|
||||||
|
img.reinterpretAsFormat(QImage::Format_ARGB32_Premultiplied);
|
||||||
|
QPainter p(q);
|
||||||
p.drawImage(q->rect(), img);
|
p.drawImage(q->rect(), img);
|
||||||
skipPaintEvent = true;
|
skipPaintEvent = true;
|
||||||
}
|
}
|
||||||
endBackingStorePainting();
|
endBackingStorePainting();
|
||||||
}
|
|
||||||
if (renderToTextureReallyDirty)
|
if (renderToTextureReallyDirty)
|
||||||
renderToTextureReallyDirty = 0;
|
renderToTextureReallyDirty = 0;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user