简体   繁体   English

如何将QDockWidget添加到QGraphicsScene?

[英]How to add a QDockWidget to QGraphicsScene?

Is it possible to add a DockWidget to my QGraphicsScene scene .? 是否可以在我的QGraphicsScene场景中添加DockWidget? If yes how to do it. 如果是,该怎么做。

The best way I see to achieve this would be to create a QMainWindow , set your graphicsScene as the central widget with 我看到的最好的方法是创建一个QMainWindow ,将您的graphicsScene设置为

QMainWindow::setCentralWidget(QWidget* widget);

After that, simply add your QDockWidget in the QMainWindow with 之后,只需使用以下命令将您的QDockWidget添加到QMainWindow中:

QMainWindow::addDockWidget(Qt::DockWidgetArea area, QDockWidget* dockwidget);

This option also allows you to add toolbar(s) or menu(s) easily. 此选项还允许您轻松添加工具栏或菜单。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM