#include <QtGui> //For the GUI components
#include "ui_main_window.h" //generated from QT Designer
void setup_menu_bar(QMainWindow *mw) {
QMenu *fileMenu = mw->menuBar()->addMenu("&File") ;
//QT on Mac automagically moves these to the application menu item because
//they have the strings 'quit', 'about' etc. in them
//(http://doc.trolltech.com/4.4/qmenubar.html#details)
fileMenu->addAction("&About", mw, SLOT(close()));
fileMenu->addAction("&Quit", mw, SLOT(close()));
}
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QMainWindow *mw = new QMainWindow;
Ui::MainWindow ui;
ui.setupUi(mw);
setup_menu_bar(mw);
//putting this line before setupUi causes menubar to be erased
mw->show();
return app.exec();
}
[code -> html conversion using Francois' tool]
Comments
Post a Comment