Unsolved QDockWidget resize handle moves only in one direction
-
I'm developing an program with plugins, so I need
QDockWidget
. I'm not setting any size policies or anything, and I'm having some asymmetric behavior. The following is how my window looks like:
What I wanna achieve: make the log view smaller (at least by hand, by dragging the slider).
If I put my mouse on the area between the Log view and the two upper widgets, I can move only in 1 direction, which is up. Another even weirder way to demonstrate the problem is if I right-click between the dock widgets and uncheck "Log view" (where the dock widgets interface creates a menu with checkboxes automatically), and then check it again, the Log view widget appears again, but with a different size (depending on the position of the mouse), and possibly smaller. Now I take the slider again, and move it up, and then, again, I can't move it down anymore!!!
The following is my code for creating the Widget:
QDockWidget *MainWindow::createDockWidget(QString windowName, QWidget *innerWidget, Qt::DockWidgetArea area) { QDockWidget *dock = new QDockWidget(windowName, this); dock->setWidget(innerWidget); addDockWidget(area, dock); dock->setAllowedAreas(Qt::AllDockWidgetAreas); return dock; }
where this is a helper function, and this is how I call it:
modelTreeWidget = new ModelsTreeWidget; modelsDock = createDockWidget(tr("Models tree"), modelTreeWidget, Qt::LeftDockWidgetArea); propertiesDock = createDockWidget(tr("Properties view"), new PropertiesWidget, Qt::RightDockWidgetArea); auto loggerWidget = new LoggerWidget; logDock = createDockWidget(tr("Log view"), loggerWidget, Qt::BottomDockWidgetArea);
I'm using Qt 5.7.1 on Debian Stretch.
-
Does the behaviour change if you set a central widget? i.e. call
setCentralWidget(new QWidget(this));
-
@VRonin Thank you, that works. Is this the only way to go? what if I want all the QDockWidgets to fill the screen?