Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个动态显示图像的 QGraphicsView。我还使用 fitInView 功能来调整窗口大小。现在我需要在 QGraphicsView 的顶部添加菜单栏。如何实施?请帮忙。我是 Qt 新手
作为初学者,将QGraphicsView放入QVBoxLayout并创建QMenuBar并将其插入图形视图上方可能是最简单的。
QMenuBar *bar = new QMenuBar(); ui->yourVerticalLayout->insertWidget( 0, bar ); QMenu* yourMenu = bar->addMenu("Your Menu title"); QAction* yourFirstAction = yourMenu->addAction("Your First Action");