3

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

4

1 回答 1

1

如果您使用大量QDockWidgets,只需启用停靠嵌套可能是解决潜在问题的方法。

如果您绝对需要在 内有一个小部件QMainWindow,您可以尝试QMainWindow在第一个小部件中放置另一个。您可能必须将第二个的windowFlags属性设置QMainWindowQt::Widget.

于 2012-06-14T20:05:24.990 回答