/* Perform menu command COMMAND. */ Boolean AppMenuDoCommand (UInt16 command) { Boolean handled = false; FormDesc *fd; /* See if menu command is a form switch. */ for (fd = g_formList; fd; fd = fd->next) { if (fd->menuCommandID == command) { SwitchToForm (fd->formID); return true; } } /* Handle the rest of the items. */ switch (command) { case CommonOptionsPreferences: PrefShowSetupForm(); return true; case CommonOptionsAbout: AboutShow(); return true; #if 0 case CommonOptionsSwitchclass: SPREF (bluetoothClass) = (SPREF (bluetoothClass) + 1) % 5; SPREF (bluetoothSDP) = (SPREF (bluetoothSDP) + 1) % 5; return true; #endif case CommonConnectionAddDevice: BTSelectDevice(); return true; case CommonConnectionConnect: ENQUEUE (CmdInitiateConnect); return true; case CommonConnectionDisconnect: ENQUEUE (CmdInitiateDisconnect); return true; default: break; } return handled; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->setWindowIcon(QIcon("://icon/mainIcon.png")); this->setWindowTitle("Numerical Analysis Project"); this->srcImg = new QImage(); this->destImg = srcImg; this->originPicture = new QGraphicsView(this); //初始化主窗口界面 QString srcRoute = "://icon/welcomeText.jpg"; srcImg->load(srcRoute); this->ImageShow(srcImg); //初始化菜单栏 QAction *openAction = new QAction(tr("打开"), this); QObject::connect(openAction, SIGNAL(triggered()), this, SLOT(OpenPicture())); QAction *saveOption = new QAction(tr("保存"), this); QObject::connect(saveOption, SIGNAL(triggered()), this, SLOT(SavePicture())); QMenu *openMenu = menuBar()->addMenu(tr("文件")); openMenu->addAction(openAction); openMenu->addAction(saveOption); QAction *manipOption = new QAction(tr("操作图片"), this); QObject::connect(manipOption, SIGNAL(triggered()), this, SLOT(ManipShow())); QMenu *manipMenu = menuBar()->addMenu(tr("操作")); manipMenu->addAction(manipOption); QAction *guideOption = new QAction(tr("使用方法"), this); QObject::connect(guideOption, SIGNAL(triggered()), this, SLOT(GuideShow())); QAction *aboutOption = new QAction(tr("关于"), this); QObject::connect(aboutOption, SIGNAL(triggered()), this, SLOT(AboutShow())); QMenu *helpMenu = menuBar()->addMenu(tr("帮助")); helpMenu->addAction(guideOption); helpMenu->addAction(aboutOption); }