Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't move QDockWidget

I want to create a widget that contains several QDockWidgets on purpose of putting it into a QMainWindow. Problem is that if I add QDockWidgets to my QWidget class with layout->addWidget(dockWidget);(I don't know any other way of doing it) and then setLayout(layout) I can't do anything to the QDockWidgets but dock and undock. I can't move them, I can't position them in another place.

QMainWindow has this feature addWidgets that QWidget doesn't have. Using QMainWindow everything works perfect, but I want it to work the same if I add a QWidget object(containing some QDockWidgets) to QMainWindow.

Is there any possibility to make my QWidget fully support those QDockWidgets, and use the on full potential(move, scale, dock, change position)?

Thanks


1 Answers

If you're using a lot of QDockWidgets, simply enabling dock nesting might be the solution to the underlying problem.

If you absolutely need to have a widget inside the QMainWindow, you can try putting another QMainWindow in the first one. You might have to set the windowFlags property of the second QMainWindow to Qt::Widget.

like image 193
Daan Avatar answered Dec 08 '25 00:12

Daan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!