I'm working on little CAD like program for our indie game project. I already have nicely working form with a bunch of widgets and so on. But one thing is bothering me.
I'm using DockWidgets
and inside these i have QTableWidget
and empty Horizontal layout as container waiting for my OpenGLWindow
class that i later initialize and put it into.
When i start the app all DockWidgets
are set to size of QTableWidget
ignoring that the OpenGLWindow
was added to the layout when the form instance was created and I have to expand the dock by myself.
So is there any way to tell the dock widget to expand as much as possible?
My OpenGLWindow
looks like:
class OpenGLWindow : public QWindow, protected QOpenGLFunctions
And that's how I'm inserting it to the layout on startup:
OpenGLWindow * glwindow = new OpenGLWindow(...);
QWidget * container = QWidget::createWindowContainer(glwindow,ui->dockWidget,Qt::Window);
ui->horizontalLayout->addWidget(container);
I've tried to expand it by many different weird ways and now I'm realy out of ideas.
Thanks for help.
Update: Thats size policy of container:
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Update: The main problem is to adjust the QDockWidget to its maximal possible width.
Update: I'm still having same problem, but now new one appeared when I added one more OpenGLWindow sharing context with the previous one. Both container widgets are now little oversized at startup so they overlay the DockWidgets title and when i resize any widget within the main window they just resize to normal size like expected.