when i add the widget to the main window, by default the action menu item will be present, how to remove that?
menuBar()->setVisible(false);
verAction = new QAction(tr("&Version"),this);
menuBar()->addAction(verAction);
connect(verAction, SIGNAL(triggered()),this, SLOT(displayVersion()));
displayAction = new QAction(tr("&Display"),this);
menuBar()->addAction(displayAction);
connect(displayAction, SIGNAL(triggered()),this, SLOT(displayMessage()));
exitAction = new QAction(tr("&Exit"),this);
menuBar()->addAction(exitAction);
connect(exitAction, SIGNAL(triggered()),this, SLOT(close()));
Thanks
If you want to hide an QAction and display it when you need it, you can use the setVisible function.
If you want to remove the menu bar from the QMainWindow, you can use the QT_NO_MENUBAR preprocessor to remove all uses of a QMenuBar. If you are not using facilities provided by QMainWindow, maybe you can use a simple QWidget as main window in your application.
[Edit]
If you want to hide QActions at runtime, you will find them as member of the QMainWindow's UI. For example if you have a QAction named actionTest, you will access it like that: this->ui->actionTest->setVisible(false);