I have been having problems adding a menu item to the built in menu bar in a Qt desktop application. I copied the code provided in the QMainWindow class reference documentat
I know its late by 4 yrs, but i ran into same issue & spotted this on the Qt forum for ubuntu/Mac OS.
https://forum.qt.io/topic/7276/menu-not-showing-up-in-menubar/15
Add the following to your main.cpp before you declare your Mainwindow w:
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
In my case my main.cpp file now looks like:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
AddressBook addressBook;
AddressBookController controller (&addressBook);
QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); //fix for menubar notshowing in ubuntu
MainWindow w(&controller);
w.show();
return a.exec();
}