Question

I have a QGraphicsView which shows images dynamically. I also used fitInView feature to resize the window. Now I need to add the menu bar at the top of the QGraphicsView. How to implement this? Please help. I am new in Qt

Was it helpful?

Solution

As beginner it is probably easiest to place your QGraphicsView into a QVBoxLayout and create a QMenuBar and insert it above your graphics view.

QMenuBar *bar = new QMenuBar();
ui->yourVerticalLayout->insertWidget( 0, bar );

QMenu* yourMenu = bar->addMenu("Your Menu title");
QAction* yourFirstAction = yourMenu->addAction("Your First Action");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top