QMdiSubWindow: is it possible to add menu strip?
Solved
General and Desktop
-
-
Hi
menu strip is menu bar ? like MainWindow has ?
While you cannot do it in Design mode, it is possible to insert such menu
via code. However, you need to add a layout also to keep it at top .like
void MainWindow::on_pushButton_released() { // create new window QMdiSubWindow *subWindow1 = new QMdiSubWindow(ui->mdiArea); subWindow1->resize(300, 100); // create new widget for the mdi window ( the inner ) QWidget *myWidget = new QWidget(subWindow1); myWidget->show(); // make layout and a menu bar QVBoxLayout *boxLayout = new QVBoxLayout(myWidget); QMenuBar *menuBar = new QMenuBar(); QMenu *fileMenu = new QMenu("File"); menuBar->addMenu(fileMenu); fileMenu->addAction("Save"); fileMenu->addAction("Exit"); // assign menubar to widget boxLayout->setMenuBar(menuBar); // set widget to the MDI window subWindow1->setWidget(myWidget); subWindow1->show(); }