summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget_qpa.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2013-11-05 12:06:28 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-10 15:37:51 +0100
commitb088e4827f427189334e8a1c5b4f2b8b0b713fc2 (patch)
treee792c60db729c186f739b9e8e1553d9184272c58 /src/widgets/kernel/qwidget_qpa.cpp
parenteb5c0f4b1266702c016b032e281bb92a3a642da6 (diff)
Fix bug on X11 with WA_TranslucentBackground and native child windows.
The native child windows need to inherit the parent's visual in order to have a translucent background as well. Surface with type QSurface::OpenGLSurface should not be forced to use the parent window's visual - the parent visual for instance, might not even be GL capable. Changing WA_TranslucentBackground during runtime is not supported, for two reasons: 1) Other platform plugins seem not to support it 2) It would require recreating X windows. Task-number: QTBUG-29625 Change-Id: Ic1474dd2de99069027481c7db6bf865f9b8d616d Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget_qpa.cpp')
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 3281e0c6f7..0fd794cc02 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -118,11 +118,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->resize(q->size());
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
- if (q->testAttribute(Qt::WA_TranslucentBackground)) {
- QSurfaceFormat format;
+ QSurfaceFormat format = win->requestedFormat();
+ if ((flags & Qt::Window) && win->surfaceType() != QSurface::OpenGLSurface
+ && q->testAttribute(Qt::WA_TranslucentBackground)) {
format.setAlphaBufferSize(8);
- win->setFormat(format);
}
+ win->setFormat(format);
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle()) {