diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-01-09 12:54:08 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-09 17:23:03 +0100 |
commit | fd372f3866acecf31f69992d6d99fc7c965018bb (patch) | |
tree | d0d62e9168c0286a3ce08700f90e023ee1b96c17 /src/widgets | |
parent | eebf42cc0d99534e26da7510c3e72fba339b9829 (diff) |
Update translucency correctly in QtWidgets.
Fixes breakage introduced by cdc436ebe625153c626784a15cb224556fca3728 .
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>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 38d3198f2f..e0b1236679 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -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) |