summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2019-06-21 16:31:04 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2019-07-02 16:35:18 +0200
commit555661b625c40f21a6a3e4c73e928a6e8a46db20 (patch)
treec10f08ab3c19596fabfee918b5a94a6597062a79 /src
parent1eeab2d27f61485cb53364d40339a8d832a076e9 (diff)
Update visible window's alpha when toggling WA_TranslucentBackground
QWidgetPrivate::updateIsTranslucent sets the surface format of the window with the alpha based on the translucency attribute, so we need to call this function when the attribute value changes. The test can confirm that the window's requested surface format has changed, we can't rely on what is actually set, and don't have to rely on hard-coded values like 8bit alpha. While WA_NoSystemBackground needs to be set for WA_TranslucentBackground to have an effect, we can't clear the attribute when clearing translucency (as it might have been set explicitly). Change-Id: I238d6930b7e0488397467a4e035b5f530566a1ff Fixes: QTBUG-60822 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kernel/qwidget.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 6ef3a4f163..50745175b4 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -11474,10 +11474,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
}
break;
case Qt::WA_TranslucentBackground:
- if (on) {
+ if (on)
setAttribute(Qt::WA_NoSystemBackground);
- d->updateIsTranslucent();
- }
+ d->updateIsTranslucent();
break;
case Qt::WA_AcceptTouchEvents: