如何停靠/取消停靠小部件(QDockWidget?)?
我有一个带有 4 个 QGraphicsViews 的小部件,我希望它们可以停靠。我已将 QGraphicsView 放入 QDockWidget 中。然后我能够取消停靠视图,但我不知道如何将视图停靠回原来的位置。一开始,有一个带有取消停靠按钮的栏,但是当小部件取消停靠时,这个栏就消失了。
我需要做什么才能将小部件停靠在其原始/起始位置? 或者这个 QDockWidget 不适合这样的事情吗? 我将非常感谢您的帮助。
I have a widget with 4 QGraphicsViews and I want them to be dockable. I've put a QGraphicsView in a QDockWidget. Then I was able to undock the view, but I don't know how to dock the view back, where it was. At the begin, there is a bar with an undock button, but when the widget is undocked, then this bar is gone.
What do I need to do, to dock the widget on it's original/starting position?
Or is this QDockWidget not for things like that?
I would be very grateful for some help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将小部件拖回其起始位置,主窗口就会自动抓取它。如果这对您不起作用,请查看
Dock Widgets
示例程序(Qt Creator -> 帮助 -> 内容 -> 教程和示例 -> 主窗口示例 ->停靠小部件)。如果这个示例程序也不起作用,那么您的 Qt 安装就有问题!Just drag the widget back to its starting position, and the main window should grab it automatically. If this doesn't work for you, take a look at the
Dock Widgets
example program (Qt Creator -> Help -> Contents -> Tutorials and Examples -> Main Window Examples -> Dock Widgets). If even this example program doesn't work, then something is wrong with your Qt installation!