summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp6
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp7
2 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index e2c6932992..f46bed77d6 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -280,8 +280,12 @@ void QXcbWindow::create()
if (parent()) {
xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window();
m_embedded = parent()->window()->type() == Qt::ForeignWindow;
- }
+ QSurfaceFormat parentFormat = parent()->window()->requestedFormat();
+ if (window()->surfaceType() != QSurface::OpenGLSurface && parentFormat.hasAlpha()) {
+ window()->setFormat(parentFormat);
+ }
+ }
m_format = window()->requestedFormat();
#if (defined(XCB_USE_GLX) || defined(XCB_USE_EGL)) && defined(XCB_USE_XLIB)
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()) {