summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellogl2/glwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/opengl/hellogl2/glwidget.cpp')
-rw-r--r--examples/opengl/hellogl2/glwidget.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/opengl/hellogl2/glwidget.cpp b/examples/opengl/hellogl2/glwidget.cpp
index 9738dcda20..6505ad3141 100644
--- a/examples/opengl/hellogl2/glwidget.cpp
+++ b/examples/opengl/hellogl2/glwidget.cpp
@@ -55,8 +55,11 @@ GLWidget::GLWidget(QWidget *parent)
// --transparent causes the clear color to be transparent. Therefore, on systems that
// support it, the widget will become transparent apart from the logo.
m_transparent = QCoreApplication::arguments().contains(QStringLiteral("--transparent"));
- if (m_transparent)
- setAttribute(Qt::WA_TranslucentBackground);
+ if (m_transparent) {
+ QSurfaceFormat fmt = format();
+ fmt.setAlphaBufferSize(8);
+ setFormat(fmt);
+ }
}
GLWidget::~GLWidget()