Transparent QWidget over a QGLWidget
Unsolved
General and Desktop
-
I am trying to have a transparent QWidget over a QGLWidget something like below:
QWidget *transparentWidget = new QWidget; transparentWidget->setFixedSize(1440, 720); transparentWidget->setAttribute(Qt::WA_TranslucentBackground); QGLWidget *glWidget = new QGLWidget; transparentWidget->setParent(glWidget); transparentWidget->setGeometry(10, 50, 500, 500); transparentWidget->show(); glWidget->show();
But I am not getting the desired result. transparentWidget is being added at the specified geometry, however it is not transparent.
How can I fix this??
Any leads would be appreciated....
-
Also, if you are on Qt 5.4 or newer, I suggest replacing
QGLWidget
withQOpenGLWidget
.QOpenGLWidget
resolves numerous issues withQGLWidget
: https://blog.qt.io/blog/2014/09/10/qt-weekly-19-qopenglwidget/