[Solved] Know the size of the central zone?
The hyerarchy of my system is like this:
QMainWindow has a Graphics View assigned as the central widget with an OPENGL viewport showing a scene.
It also has a QWidget with a Vertical Layout under Central Widget (so it evades the toolbar).
The reason to have a container widget for all things FLOATING over the openGL viewport on the background
is because i need it to have a new layout.
Then i add all the buttons inside.
When i do this:
mainWindowContainer_ = new QWidget(mainWindow_->centralWidget());
I get a black background all over the viewport... and the size is bigger, so i see my Windows Start bar over it.
The main window is using "showMaximized"
I found out how to do it.
I added this widget under the Graphics Scene with addWidget. That way it creates a Proxy between so it´s like a graphics item. Now opengl under works.
Then i reimplemented the graphicsView resize event, so it tells this widget to resize too.
After using showMaximized to the window, it resized the graphics viewport, and then the widget container, so the UI now works superb.
What happens is that Layouts don´t work good with OpenGL underneath. It appears black, doesn´t repaint openGL.
If you remove the layout, it works, but then you have to position widgets around by hand.
And if you have stylesheet assigned and round corners, the corners will be black too. A work around is to add this flag:
widget->setAttribute( Qt::WA_TranslucentBackground );