12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include <qapplication.h>
- #include <qmenubar.h>
- #include <qpopupmenu.h>
- #include "example_g3.h"
- MyWindow::MyWindow(QWidget *parent, const char *name)
- : QWidget(parent, name)
- {
- setCaption("Main Window");
- QPopupMenu *file_popup = new QPopupMenu(this);
- file_popup->insertItem("&New", this, SLOT(fileNew()));
- file_popup->insertItem("&Open...", this, SLOT(fileOpen()));
- file_popup->insertItem("&Save", this, SLOT(fileSave()));
- file_popup->insertItem("Save &as...", this, SLOT(fileSaveAs()));
- file_popup->insertSeparator();
- file_popup->insertItem("&Print", this, SLOT(filePrint()));
- file_popup->insertSeparator();
- file_popup->insertItem("E&xit", qApp, SLOT(quit()));
- QPopupMenu *help_popup = new QPopupMenu(this);
- help_popup->insertItem("&About", this, SLOT(helpAbout()));
- menu = new QMenuBar(this);
- menu->insertItem("&File", file_popup);
- menu->insertItem("&?", help_popup);
- }
- MyWindow::~MyWindow()
- {
- }
- void MyWindow::helloClicked()
- {
- }
- int main(int argc, char **argv)
- {
- QApplication a(argc, argv);
- MyWindow w(0, "main window");
- w.setGeometry(10, 10, 200, 150);
- a.setMainWidget(&w);
- w.show();
- return a.exec();
- }
|