indira
indira

Reputation: 6687

How to implement Menu bar inside QGraphicsView?

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

Upvotes: 0

Views: 1069

Answers (1)

spoorcc
spoorcc

Reputation: 2955

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");

Upvotes: 1

Related Questions