summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-07-14 10:43:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-03 16:04:38 +0000
commit833d6cdb309f360e1d1e97808d4db289d98cef75 (patch)
tree83d5eca4ae99b0c82d956836e311ae09ec957dae
parentd2ed18382df323f50ba9800f6db9a8e6dc15fa8b (diff)
Evaluate TranslucentBackground when (re)creating the window
The problem is reported in combination with the new 6.4 way of handling texture-based widgets, but this looks like something that has always been missing: Setting WA_TranslucentBackground changes the QWidgetWindow's format, and this is done upon calling setAttribute(). That's good for most cases, but the changes to the QWindow's format are lost when the window is destroyed and then the widget gets another window later. This is not that common, but can happen. For example, if a top-level widget is parented under something else, and then later it is parented to null again, so that it is toplevel once again, background transparency can be lost because nothing re-evaluates the WA_TranslucentBackground flag after the initial setAttribute(), and so the widget's second QWidgetWindow is not set up accordingly (because this new QWindow may not have alpha specified in the QSurfaceFormat which may or may not be a problem, depending on the platform / windowing system) The simple solution is to evaluate the attribute not just when setting it, but also when a new QWidgetWindow is created for the widget. Fixes: QTBUG-104952 Change-Id: I92746caea5561544f90395d5473ac28d43143924 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 856bb38eafcf55113a3debbdd6905dc71600cc61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/widgets/kernel/qwidget.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index ab129b73e7..b28dcfc6f2 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1398,6 +1398,8 @@ void QWidgetPrivate::createTLSysExtra()
#endif
if (isTipLabel || isAlphaWidget || q->inherits("QRollEffect"))
qt_window_private(extra->topextra->window)->setAutomaticPositionAndResizeEnabled(false);
+
+ updateIsTranslucent();
}
}