I've got simple GLWidget class inherited from QGLWidget where I render some simple geometry. I instantiate the object of my GLWidget class inside MainWindow, where I display all widgets associated with GLWidget, like QSliders, QPushButtons to interact with the openGL scene. I have two options, I can embed the GLWidget inside my GUI or just show as a separate widget using show() function. Everything works fine. Recently I tried to add some transparent widgets over the GLWidget, like transparent QDialog or QPushButton. I tried to achieve that using similar approach to the one presented in - 'boxes' project from Qt demos,
using QGraphicsView and QGraphicsScene. Everything is fine when I try to show the widget inside main.cpp, but when I try to show it inside the MainWindow, something is not right, as the widget appears and disappears very quickly and the rest of the interface - everything what is inside MainWindow is displayed properly, but the QGraphicsView is not displayed.

Example code:

Qt Code:
  1. QTabWidget *tabWidget = new QTabWidget;
  3. QGraphicsProxyWidget *proxy = scene.addWidget(tabWidget);
  5. QGraphicsView view(&scene);
  6. view.show();
To copy to clipboard, switch view to plain text mode 

The above code works fine in main but doesn't in MainWindow.

I would be very grateful if someone could help me to fix that problem, if not I am happy to try something different
to add transparent widgets on top of QGLWidget. Any suggestions?

Thank you.