Update translucency correctly in QtWidgets.
Fixes breakage introduced by cdc436ebe6
.
Top level widgets with translucent backgrounds were invisible since
opacity was set to 0.
Task-number: QTBUG-28531
Change-Id: I97058ac1b971422f3bda3a5ffed479ec55bfe5d4
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
parent
eebf42cc0d
commit
fd372f3866
@ -2080,8 +2080,15 @@ void QWidgetPrivate::setOpaque(bool opaque)
|
||||
void QWidgetPrivate::updateIsTranslucent()
|
||||
{
|
||||
Q_Q(QWidget);
|
||||
if (QWindow *window = q->windowHandle())
|
||||
window->setOpacity(isOpaque ? qreal(1.0) : qreal(0.0));
|
||||
if (QWindow *window = q->windowHandle()) {
|
||||
QSurfaceFormat format = window->format();
|
||||
const int oldAlpha = format.alphaBufferSize();
|
||||
const int newAlpha = q->testAttribute(Qt::WA_TranslucentBackground)? 8 : 0;
|
||||
if (oldAlpha != newAlpha) {
|
||||
format.setAlphaBufferSize(newAlpha);
|
||||
window->setFormat(format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrush &brush)
|
||||
|
Loading…
Reference in New Issue
Block a user