summaryrefslogtreecommitdiffstats
path: root/examples/opengl/hellogl2/main.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-09-23 17:40:27 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-09-24 12:51:37 +0000
commitb46ffbca0cfad41599873d4ca19dc79167c3955f (patch)
treee8176dee68e341de8efe82eb442ce883f7950957 /examples/opengl/hellogl2/main.cpp
parentbf2c9fd2fdff2760f3798fd1584f2da330266c46 (diff)
Fix up QOpenGLWidget transparency support
The glColorMask call was troublesome. In addition, the Qt::WA_TranslucentBackground was misinterpreted and recommended misleadingly in the documentation. The hellogl2 example's --transparent argument was disfunctional in practice. Replace glColorMask with glBlendFuncSeparate. The hellogl2 example and the docs are now corrected wrt enabling semi-transparency in a QOpenGLWidget that is not a top-level (which is the most common case). Task-number: QTBUG-47276 Change-Id: I6f40e732d455f5efcf158649ac9a52ff9f240e85 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'examples/opengl/hellogl2/main.cpp')
-rw-r--r--examples/opengl/hellogl2/main.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/opengl/hellogl2/main.cpp b/examples/opengl/hellogl2/main.cpp
index 4dc67f6e15..554e37e19b 100644
--- a/examples/opengl/hellogl2/main.cpp
+++ b/examples/opengl/hellogl2/main.cpp
@@ -59,6 +59,10 @@ int main(int argc, char *argv[])
QSurfaceFormat::setDefaultFormat(fmt);
MainWindow mainWindow;
+ if (QCoreApplication::arguments().contains(QStringLiteral("--transparent"))) {
+ mainWindow.setAttribute(Qt::WA_TranslucentBackground);
+ mainWindow.setAttribute(Qt::WA_NoSystemBackground, false);
+ }
mainWindow.resize(mainWindow.sizeHint());
int desktopArea = QApplication::desktop()->width() *
QApplication::desktop()->height();