Skip to content

Commit

Permalink
Render QOpenGLWidget/QQuickWidget with AlwaysStackOnTop
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Allan Sandfeld Jensen committed May 31, 2018
1 parent 7e21774 commit 0a63d5f
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/widgets/kernel/qwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5593,21 +5593,23 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (renderToTexture) {
// 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.
if (!q->testAttribute(Qt::WA_AlwaysStackOnTop)) {
beginBackingStorePainting();
if (backingStore) {
QPainter p(q);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(q->rect(), Qt::transparent);
} else {
QImage img = grabFramebuffer();
QPainter p(q);
// We are not drawing to a backingstore: fall back to QImage
p.drawImage(q->rect(), img);
skipPaintEvent = true;
}
endBackingStorePainting();
beginBackingStorePainting();
if (!q->testAttribute(Qt::WA_AlwaysStackOnTop) && backingStore) {
QPainter p(q);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(q->rect(), Qt::transparent);
} else if (!backingStore) {
// 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);
skipPaintEvent = true;
}
endBackingStorePainting();
if (renderToTextureReallyDirty)
renderToTextureReallyDirty = 0;
else
Expand Down

0 comments on commit 0a63d5f

Please sign in to comment.