MenuBar::MenuBar(QObject *parent) : QObject(parent) { mMenuBar=new QMenuBar(); mHostDialog=new QInputDialog(); mFileDialog=new QFileDialog(); QVector<QMenu*> listMenu; QList<QAction*> listActions; listMenu.append(new QMenu(tr("&File"))); listMenu.append(new QMenu(tr("&Settings"))); listActions.append(new QAction(tr("Open"),this)); connect(listActions.at(0),SIGNAL(triggered()),this,SLOT(slotOpen())); listMenu.at(0)->addActions(listActions); listActions.clear(); listActions.append(new QAction(tr("Host"),this)); listActions.append(new QAction(tr("About"),this)); connect(listActions.at(0),SIGNAL(triggered()),this,SLOT(slotHost())); connect(listActions.at(1),SIGNAL(triggered()),this,SLOT(slotAbout())); listMenu.at(1)->addActions(listActions); for(int cpt=0 ; cpt < listMenu.size() ; ++cpt) { mMenuBar->addMenu(listMenu.at(cpt)); } }
void MainWindow::initUI(){ ui.menuView->addSeparator(); ui.menuView->addMenu(getStyleMenu(Settings::instance()->getStyle(), Settings::instance()->getPalette())); QString qmLocale = Settings::instance()->getLanguage(); QString qmPath = QApplication::applicationDirPath() + QDir::separator () + QString(LANGUAGE_FILE_DIR); ui.menuView->addMenu(getLanguageMenu(qmPath, qmLocale)); pluginsMenu = getPluginsMenu(); menuBar()->insertMenu(ui.menuHelp->menuAction(), pluginsMenu); ui.toolBarPlugins->addAction(getPluginsManagementAction()); connect(ui.actionBugReport, SIGNAL(triggered()), this, SLOT(slotBugReport())); connect(ui.actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout())); connect(ui.actionHelp, SIGNAL(triggered()), this, SLOT(slotHelp())); connect(ui.actionSystemConfigure, SIGNAL(triggered()), this, SLOT(slotSystemConfig())); connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(slotQuit())); //connect(ui.menuSubWindows, SIGNAL(aboutToShow()), this, SLOT(slotUpdateWindowActions())); connect(ui.mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(slotUpdateWindowActions())); }
KXNeurTray::KXNeurTray() : KSystemTray() { QPixmap pic; actions = new KActionCollection(this); menu = contextMenu(); KApplication *app = KApplication::kApplication(); // languages set in KXNeurApp::refresh_lang() menu->insertSeparator(); mode = new KAction(i18n("Set manual mode"), "embedjs", 0, app, SLOT(slotUpdateMode()), actions); mode->plug(menu); run = new KAction(i18n("Stop xneur daemon"), "stop", 0, app, SLOT(slotUpdateRun()), actions); run->plug(menu); menu->insertSeparator(); KAction *pref = KStdAction::preferences(app, SLOT(slotPref()), actions); pref->plug(menu); KAction *help = KStdAction::help(this, SLOT(slotHelp()), actions); help->plug(menu); KAction *about = KStdAction::aboutApp(this, SLOT(slotAbout()), actions); about->plug(menu); QObject::connect(menu, SIGNAL(activated(int)), app, SLOT(setMenuLang(int))); pic = kapp->iconLoader()->loadIcon("keyboard_layout", KIcon::Small); menu->changeTitle(menu->idAt(0), pic, i18n("KXNeur")); setPixmap(pic); }
VPiano::VPiano( QWidget * parent, Qt::WindowFlags flags ) : QMainWindow(parent, flags), m_midiout(0), m_midiin(0), m_currentOut(-1), m_currentIn(-1), m_inputActive(false), m_midiThru(false), m_initialized(false), m_dlgAbout(NULL), m_dlgPreferences(NULL), m_dlgMidiSetup(NULL), m_dlgKeyMap(NULL), m_dlgExtra(NULL), m_dlgRiffImport(NULL) { ui.setupUi(this); ui.actionStatusBar->setChecked(false); connect(ui.actionAbout, SIGNAL(triggered()), SLOT(slotAbout())); connect(ui.actionAbout_Qt, SIGNAL(triggered()), SLOT(slotAboutQt())); connect(ui.actionConnections, SIGNAL(triggered()), SLOT(slotConnections())); connect(ui.actionPreferences, SIGNAL(triggered()), SLOT(slotPreferences())); connect(ui.actionEditKM, SIGNAL(triggered()), SLOT(slotEditKeyboardMap())); connect(ui.actionContents, SIGNAL(triggered()), SLOT(slotHelpContents())); connect(ui.actionWebSite, SIGNAL(triggered()), SLOT(slotOpenWebSite())); connect(ui.actionImportSoundFont, SIGNAL(triggered()), SLOT(slotImportSF())); connect(ui.actionEditExtraControls, SIGNAL(triggered()), SLOT(slotEditExtraControls())); connect(ui.actionNoteNames, SIGNAL(triggered()), SLOT(slotShowNoteNames())); ui.pianokeybd->setPianoHandler(this); initialization(); }
MainWindow::MainWindow(CorePlayer * player, Playlist * playList) : MainWindowBase (0, "QtAlsaPlayer"), player_ (player), playList_ (playList), popup_ (0L), playListDialog_ (0L), updateTitleTimer_ (0L), updatePositionSlider_ (true), updateTitle_ (true) { popup_ = new QPopupMenu(this); popup_->insertItem(tr("Scopes..."), this, SLOT(slotScopes())); popup_->insertItem(tr("Effects..."), this, SLOT(slotFX())); popup_->insertItem(tr("About..."), this, SLOT(slotAbout())); popup_->insertSeparator(); popup_->insertItem(tr("CD Player (CDDA)"), this, SLOT(slotCDDA())); popup_->insertSeparator(); popup_->insertItem(tr("Exit"), qApp, SLOT(quit())); menuButton->setPopup(popup_); resize(sizeHint().width(), minimumSizeHint().height()); // poll me bitch. startTimer(200); updateTitleTimer_ = new QTimer(this); connect(updateTitleTimer_, SIGNAL(timeout()), SLOT(slotUpdateTitle())); playListDialog_ = new PlayListDialog(this, playList_); playListDialog_->hide(); }
void MainWindow::createActions() { m_resetAct = new QAction(QIcon(":/images/control_repeat_blue.png"), tr("&Reset"), this); m_resetAct->setShortcut(tr("Ctrl+R")); m_resetAct->setStatusTip(tr("Reset the program.")); connect(m_resetAct, SIGNAL(triggered()), this, SLOT(slotReset())); m_exitAct = new QAction(QIcon(":/images/door_in.png"), tr("E&xit"), this); m_exitAct->setShortcut(tr("Ctrl+Q")); m_exitAct->setStatusTip(tr("Leave the simulator")); connect(m_exitAct, SIGNAL(triggered()), this, SLOT(close())); m_loadSimAct = new QAction(QIcon(":/images/folder_page_white.png"), tr("&Load..."), this); m_loadSimAct->setShortcut(tr("Ctrl+L")); m_loadSimAct->setStatusTip(tr("Load a simulation")); connect(m_loadSimAct, SIGNAL(triggered()), this, SLOT(slotLoadSim())); m_runSimAct = new QAction(QIcon(":/images/control_play_blue.png"), tr("&Run"), this); m_runSimAct->setShortcut(tr("Ctrl+R")); m_runSimAct->setStatusTip(tr("Run the simulation")); connect(m_runSimAct, SIGNAL(triggered()), m_glViewer, SLOT(start())); m_restartSimAct = new QAction(QIcon(":/images/control_repeat_blue.png"), tr("R&estart"), this); m_restartSimAct->setStatusTip(tr("Restart the simulation")); connect(m_restartSimAct, SIGNAL(triggered()), m_glViewer, SLOT(restart())); m_resetSimAct = new QAction(QIcon(":/images/control_start_blue.png"), tr("Re&set"), this); m_resetSimAct->setStatusTip(tr("Reset the simulation")); connect(m_resetSimAct, SIGNAL(triggered()), m_glViewer, SLOT(reset())); m_stopSimAct = new QAction(QIcon(":/images/control_stop_blue.png"), tr("S&top"), this); m_stopSimAct->setShortcut(tr("Ctrl+T")); m_stopSimAct->setStatusTip(tr("Stop the simulation")); connect(m_stopSimAct, SIGNAL(triggered()), m_glViewer, SLOT(stop())); // Actions menu Options m_fullscreenAct = new QAction(QIcon(":/images/monitor.png"), tr("&Fullscreen"), this); m_fullscreenAct->setShortcut(tr("Ctrl+F")); m_fullscreenAct->setStatusTip(tr("Switch to fullscreen mode")); connect(m_fullscreenAct, SIGNAL(triggered()), this, SLOT(slotToggleFullScreen())); m_programConfigAct = new QAction(QIcon(":/images/cog.png"), tr("Program Settings"), this); m_programConfigAct->setShortcut(tr("Ctrl+P")); m_programConfigAct->setStatusTip(tr("Configure program settings")); connect(m_programConfigAct, SIGNAL(triggered()), this, SLOT(slotOpenConfigBox())); // m_simConfigAct = new QAction(QIcon(":/images/script_gear.png"), tr("Configure simulation"), this); // m_simConfigAct->setStatusTip(tr("Configure the simulation files")); // connect(m_simConfigAct, SIGNAL(triggered()), this, SLOT(openConfigBox())); m_aboutAct = new QAction(QIcon(":/images/comment.png"), tr("&About"), this); m_aboutAct->setStatusTip(tr("About the simulator")); connect(m_aboutAct, SIGNAL(triggered()), this, SLOT(slotAbout())); m_aboutQtAct = new QAction(tr("About &Qt"), this); m_aboutQtAct->setStatusTip(tr("About Qt")); connect(m_aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
/** * Construct MyMainWindow * * @param myScene * @param parent */ MyMainWindow::MyMainWindow(MyScene* myScene, QWidget *parent) : QMainWindow(parent), _myScene(myScene){ _ui.setupUi(this); _ui.viewer->setMyScene(_myScene); // Connect menu items connect(_ui.actionQuit, SIGNAL(activated()), this, SLOT(close())); connect(_ui.actionAbout, SIGNAL(activated()), this, SLOT(slotAbout())); // Connect GUI and myScene connect(_ui.radiusSpinBox, SIGNAL(valueChanged(double)), _myScene, SLOT(slotSetRadius(double))); connect(_myScene, SIGNAL(sigRadiusChanged(double)), _ui.radiusSpinBox, SLOT(setValue(double))); connect(_myScene, SIGNAL(sigRadiusChanged(double)), _ui.viewer, SLOT(updateGL())); connect(_ui.checkBox_wireframe, SIGNAL(toggled(bool)), _myScene, SLOT(slotSetWireframe(bool))); connect(_myScene, SIGNAL(sigWireframeChanged(bool)), _ui.viewer, SLOT(updateGL())); connect(_myScene, SIGNAL(sigWireframeChanged(bool)), _ui.checkBox_wireframe, SLOT(setChecked(bool))); connect(_ui.checkBox_smooth, SIGNAL(toggled(bool)), _myScene, SLOT(slotSetSmooth(bool))); connect(_myScene, SIGNAL(sigSmoothChanged(bool)), _ui.viewer, SLOT(updateGL())); connect(_myScene, SIGNAL(sigSmoothChanged(bool)), _ui.checkBox_smooth, SLOT(setChecked(bool))); connect(_ui.checkBox_normals, SIGNAL(toggled(bool)), _myScene, SLOT(slotSetDisplayNormals(bool))); connect(_myScene, SIGNAL(sigDisplayNormalsChanged(bool)), _ui.viewer, SLOT(updateGL())); connect(_myScene, SIGNAL(sigDisplayNormalsChanged(bool)), _ui.checkBox_normals, SLOT(setChecked(bool))); connect(_ui.checkBox_flipnormals, SIGNAL(toggled(bool)), _myScene, SLOT(slotSetFlipNormals(bool))); connect(_myScene, SIGNAL(sigFlipNormalsChanged(bool)), _ui.viewer, SLOT(updateGL())); connect(_myScene, SIGNAL(sigFlipNormalsChanged(bool)), _ui.checkBox_flipnormals, SLOT(setChecked(bool))); // Init GUI default values _ui.radiusSpinBox->setValue (_myScene->radius()); _ui.radiusSpinBox->setMinimum (_myScene->radiusMin()); _ui.radiusSpinBox->setMaximum (_myScene->radiusMax()); _ui.radiusSpinBox->setSingleStep(_myScene->radiusIncr()); }
QucsEdit::QucsEdit(const QString& FileName_, bool readOnly) { // set application icon setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Editor " PACKAGE_VERSION " - " + tr("File: ")); QVBoxLayout *v = new QVBoxLayout(this); QHBox *h = new QHBox(this); v->addWidget(h); QToolButton *ButtLoad = new QToolButton(h); ButtLoad->setIconSet( QIconSet(QImage(QucsSettings.BitmapDir + "fileopen.png"))); connect(ButtLoad, SIGNAL(clicked()), SLOT(slotLoad())); QToolButton *ButtSave = new QToolButton(h); ButtSave->setIconSet( QIconSet(QImage(QucsSettings.BitmapDir + "filesave.png"))); connect(ButtSave, SIGNAL(clicked()), SLOT(slotSave())); ButtSave->setDisabled(readOnly); h->setStretchFactor(new QWidget(h),5); // stretchable placeholder PosText = new QLabel(tr("Line: %1 - Column: %2").arg(1).arg(1), h); h->setStretchFactor(new QWidget(h),5); // stretchable placeholder QPushButton *ButtAbout = new QPushButton(tr("About"),h); connect(ButtAbout, SIGNAL(clicked()), SLOT(slotAbout())); QPushButton *ButtOK = new QPushButton(tr("Quit"),h); connect(ButtOK, SIGNAL(clicked()), SLOT(slotQuit())); ButtOK->setFocus(); // try using same-sized mono-spaced font in the textarea QFont fedit = QFont("Courier New"); fedit.setPointSize(QucsSettings.font.pointSize()-1); fedit.setStyleHint(QFont::Courier); fedit.setFixedPitch(true); text = new QTextEdit(this); text->setTextFormat(Qt::PlainText); text->setReadOnly(readOnly); text->setWordWrap(QTextEdit::NoWrap); text->setMinimumSize(300,200); text->setFont(fedit); text->setCurrentFont(fedit); v->addWidget(text); connect(text, SIGNAL(cursorPositionChanged(int, int)), SLOT(slotPrintCursorPosition(int, int))); // ................................................. loadFile(FileName_); }
int MyMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotAbout(); break; } _id -= 1; } return _id; }
void MainWindow::slotIconActivated(QSystemTrayIcon::ActivationReason reason) { switch (reason) { case QSystemTrayIcon::Trigger: case QSystemTrayIcon::DoubleClick: //systemInfo(); break; case QSystemTrayIcon::MiddleClick: slotAbout(); break; default: ; } }
void AnnoqtConfEditor::createActions() { newAct = new QAction( QIcon( ":/filenew.xpm" ), tr( "&New" ), this ); newAct->setShortcut( tr( "Ctrl+N" ) ); newAct->setStatusTip( tr( "Create a new file" ) ); connect( newAct, SIGNAL( triggered() ), this, SLOT( slotNewConfiguration() ) ); openAct = new QAction( QIcon( ":/fileopen.xpm" ), tr( "&Open..." ), this ); openAct->setShortcut( tr( "Ctrl+O" ) ); openAct->setStatusTip( tr( "Open an existing file" ) ); connect( openAct, SIGNAL( triggered() ), this, SLOT( slotOpen() ) ); saveAct = new QAction( QIcon( ":/filesave.xpm" ), tr( "&Save" ), this ); saveAct->setShortcut( tr( "Ctrl+S" ) ); saveAct->setStatusTip( tr( "Save the document to disk" ) ); connect( saveAct, SIGNAL( triggered() ), this, SLOT( slotSave() ) ); saveAsAct = new QAction( tr( "Save &As..." ), this ); saveAsAct->setStatusTip( tr( "Save the document under a new name" ) ); connect( saveAsAct, SIGNAL( triggered() ), this, SLOT( slotSaveAs() ) ); exitAct = new QAction( tr( "E&xit" ), this ); exitAct->setShortcut( tr( "Ctrl+Q" ) ); exitAct->setStatusTip( tr( "Exit the application" ) ); connect( exitAct, SIGNAL( triggered() ), this, SLOT( close() ) ); cutAct = new QAction( QIcon( ":/editcut.xpm" ), tr( "Cu&t" ), this ); cutAct->setShortcut( tr( "Ctrl+X" ) ); cutAct->setStatusTip( tr( "Cut the current selection's contents to the " "clipboard" ) ); connect( cutAct, SIGNAL( triggered() ), this, SLOT( slotCut() ) ); addItemAction = new QAction( QIcon( ":/item.xpm" ), tr( "New entity type" ), this ); addItemAction->setShortcut( tr( "Ctrl+E" ) ); addItemAction->setStatusTip( tr( "Add a new entity type" ) ); connect( addItemAction, SIGNAL( triggered() ), this, SLOT( slotAddItemAction() ) ); aboutAct = new QAction( tr( "&About" ), this ); aboutAct->setStatusTip( tr( "Show the application's About box" ) ); connect( aboutAct, SIGNAL( triggered() ), this, SLOT( slotAbout() ) ); aboutQtAct = new QAction( tr( "About &Qt" ), this ); aboutQtAct->setStatusTip( tr( "Show the Qt library's About box" ) ); connect( aboutQtAct, SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) ); cutAct->setEnabled( true ); }
void MainWindow::createActions() { // file open action fileOpenAction = new QAction(QIcon(":/images/open.png"),tr("Open"),this); // 打开文件 fileOpenAction->setShortcut(tr("Ctrl+O")); fileOpenAction->setStatusTip(tr("open a file")); connect(fileOpenAction,SIGNAL(triggered()),this,SLOT(slotOpenFile())); // file new action fileNewAction = new QAction(QIcon(":/images/new.png"),tr("New"),this); // 新建文件 fileNewAction->setShortcut(tr("Ctrl+N")); fileNewAction->setStatusTip(tr("new file")); connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotNewFile())); // save file action fileSaveAction = new QAction(QPixmap(":/images/save.png"),tr("Save"),this); // 保存文件 fileSaveAction->setShortcut(tr("Ctrl+S")); fileSaveAction->setStatusTip(tr("save file")); connect(fileSaveAction,SIGNAL(activated()),this,SLOT(slotSaveFile())); // exit action exitAction = new QAction(tr("Exit"), this); // 退出 exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("exit")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); cutAction = new QAction(QIcon(":/images/cut.png"), tr("Cut"), this); // 剪切 cutAction->setShortcut(tr("Ctrl+X")); cutAction->setStatusTip(tr("cut to clipboard")); connect(cutAction, SIGNAL(triggered()), text, SLOT(cut())); copyAction = new QAction(QIcon(":/images/copy.png"), tr("Copy"), this); // 复制 copyAction->setShortcut(tr("Ctrl+C")); copyAction->setStatusTip(tr("copy to clipboard")); connect(copyAction, SIGNAL(triggered()), text, SLOT(copy())); pasteAction = new QAction(QIcon(":/images/paste.png"), tr("Paste"), this); // 粘贴 pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setStatusTip(tr("paste clipboard to selection")); connect(pasteAction, SIGNAL(triggered()), text, SLOT(paste())); aboutAction = new QAction(tr("About"), this); // 关于 connect(aboutAction, SIGNAL(triggered()), this, SLOT(slotAbout())); }
WindowMain::WindowMain(QWidget *parent, Qt::WindowFlags flags) :QMainWindow(parent, flags) { ui.setupUi(this); setWindowState(Qt::WindowMaximized); m_fileMenu = ui.menuBar->addMenu(QStringLiteral("文件")); QAction* webImportAct = m_fileMenu->addAction(QStringLiteral("从Html导入.....")); connect(webImportAct, SIGNAL(triggered()), this, SLOT(slotImportFromHtml())); m_toolMenu = ui.menuBar->addMenu(QStringLiteral("工具")); QAction* viewSingleAct = m_toolMenu->addAction(QStringLiteral("单个号码通信视图")); connect(viewSingleAct, SIGNAL(triggered()), this, SLOT(slotViewSingle())); QAction* chartAct = m_toolMenu->addAction(QStringLiteral("数据列表")); connect(chartAct, SIGNAL(triggered()), this, SLOT(slotCallLogTable())); QMenu* helpMenu = ui.menuBar->addMenu(QStringLiteral("帮助")); QAction* abortAct = helpMenu->addAction(QStringLiteral("关于软件")); connect(abortAct, SIGNAL(triggered()), this, SLOT(slotAbout())); QwtText axisTitle; QFont axisTitleFont; axisTitleFont.setPixelSize(16); axisTitle.setText(QStringLiteral("通话时间(秒)")); axisTitle.setFont(axisTitleFont); m_timePlot = new CallLogPlot(ui.qwtPlot, this); m_timePlot->getPlot()->enableAxis(QwtPlot::xBottom, false); m_timePlot->getPlot()->setAxisTitle(QwtPlot::yLeft, axisTitle); axisTitle.setText(QStringLiteral("通话次数(次)")); axisTitle.setFont(axisTitleFont); m_countPlot = new CallLogPlot(ui.qwtPlot_2, this); m_countPlot->getPlot()->setAxisTitle(QwtPlot::yLeft, axisTitle); ui.dateEdit->setCalendarPopup(true); ui.dateEdit_2->setCalendarPopup(true); connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(slotDateTimeChanged())); connect(ObjectRegister::instance(), SIGNAL(signalTrialTimeout()), this, SLOT(slotTrialTimeout())); connect(ObjectRegister::instance(), SIGNAL(signalSuccessRegister()), this, SLOT(slotSuccessRegister())); slotCallLogChanged(); }
void MainWindow::createActions() { //通过图片路径来实现添加Qt资源文件目的 fileOpenAction = new QAction(QIcon("C:/qt/Mwindow/open.png"),tr("Open"),this); fileOpenAction->setShortcut(tr("Ctrl+O")); fileOpenAction->setStatusTip(tr("Open a file")); connect(fileOpenAction,SIGNAL(triggered()),this,SLOT(slotOpenFile())); fileNewAction = new QAction(QIcon("C:/qt/Mwindow/new.png"),tr("New"),this); fileNewAction->setShortcut(tr("Ctrl+N")); fileNewAction->setStatusTip(tr("new file")); connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotNewFile())); fileSaveAction = new QAction(QIcon("C:/qt/Mwindow/save.png"),tr("Save"),this); fileSaveAction->setShortcut(tr("Ctrl+S")); fileNewAction->setStatusTip(tr("save file")); connect(fileNewAction,SIGNAL(triggered()),this,SLOT(slotSaveFile())); exitAction = new QAction(tr("Exit"),this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("exit")); connect(exitAction,SIGNAL(triggered()),this,SLOT(close())); cutAction = new QAction(QIcon("C:/qt/Mwindow/cut.png"),tr("Cut"),this); cutAction->setShortcut(tr("Ctrl+X")); cutAction->setStatusTip(tr("cut to clipboard")); connect(cutAction,SIGNAL(triggered()),text,SLOT(cut())); copyAction = new QAction(QIcon("C:/qt/Mwindow/copy.png"),tr("Copy"),this); copyAction->setShortcut(tr("Ctrl+C")); copyAction->setStatusTip(tr("copy to clipboard")); connect(copyAction,SIGNAL(triggered()),this,SLOT(copy())); pasteAction = new QAction(QIcon("C:/qt/Mwindow/paste.png"),tr("paste"),this); pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setStatusTip(tr("paste clipboard to selection")); connect(pasteAction,SIGNAL(triggered()),this,SLOT(paste())); aboutAction = new QAction(tr("About"),this); connect(aboutAction,SIGNAL(triggered()),this,SLOT(slotAbout())); }
void JuffEd::initActions() { CommandStorageInt* st = Juff::Utils::commandStorage(); st->addAction(FILE_NEW, tr("&New"), this, SLOT(slotFileNew())); st->addAction(FILE_OPEN, tr("&Open"), this, SLOT(slotFileOpen())); st->addAction(FILE_SAVE, tr("&Save"), this, SLOT(slotFileSave())); st->addAction(FILE_SAVE_AS, tr("Save as"), this, SLOT(slotFileSaveAs())); st->addAction(FILE_SAVE_ALL, tr("Save all"), this, SLOT(slotFileSaveAll())); st->addAction(FILE_RELOAD, tr("&Reload"), this, SLOT(slotFileReload())); st->addAction(FILE_RENAME, tr("Rename"), this, SLOT(slotFileRename())); st->addAction(FILE_CLOSE, tr("Close"), this, SLOT(slotFileClose())); st->addAction(FILE_CLOSE_ALL, tr("Close All"), this, SLOT(slotFileCloseAll())); st->addAction(FILE_PRINT, tr("&Print"), this, SLOT(slotFilePrint())); st->addAction(FILE_EXIT, tr("Exit"), this, SLOT(slotFileExit())); st->addAction(SESSION_NEW, tr("New session"), this, SLOT(slotSessionNew())); st->addAction(SESSION_OPEN, tr("Open session"), this, SLOT(slotSessionOpen())); st->addAction(SESSION_SAVE, tr("Save session as..."), this, SLOT(slotSessionSaveAs())); st->addAction(EDIT_UNDO, tr("Undo"), this, SLOT(slotEditUndo())); st->addAction(EDIT_REDO, tr("Redo"), this, SLOT(slotEditRedo())); st->addAction(EDIT_CUT, tr("Cut"), this, SLOT(slotEditCut())); st->addAction(EDIT_COPY, tr("Copy"), this, SLOT(slotEditCopy())); st->addAction(EDIT_PASTE, tr("Paste"), this, SLOT(slotEditPaste())); st->addAction(SEARCH_FIND, tr("Find"), this, SLOT(slotFind())); st->addAction(SEARCH_FIND_NEXT, tr("Find next"), this, SLOT(slotFindNext())); st->addAction(SEARCH_FIND_PREV, tr("Find previous"), this, SLOT(slotFindPrev())); st->addAction(SEARCH_REPLACE, tr("Replace"), this, SLOT(slotReplace())); st->addAction(SEARCH_GOTO_LINE, tr("Go to line"), this, SLOT(slotGotoLine())); st->addAction(SEARCH_GOTO_FILE, tr("Go to file"), this, SLOT(slotGotoFile())); st->addAction(VIEW_ZOOM_IN, tr("Zoom In"), this, SLOT(slotZoomIn())); st->addAction(VIEW_ZOOM_OUT, tr("Zoom Out"), this, SLOT(slotZoomOut())); st->addAction(VIEW_ZOOM_100, tr("Zoom 100%"), this, SLOT(slotZoom100())); st->addAction(VIEW_FULLSCREEN, tr("Fullscreen"), this, SLOT(slotFullscreen())); st->addAction(TOOLS_SETTINGS, tr("Settings"), this, SLOT(slotSettings())); st->addAction(HELP_ABOUT, tr("About"), mw_, SLOT(slotAbout())); st->addAction(HELP_ABOUT_QT, tr("About Qt"), mw_, SLOT(slotAboutQt())); }
VPiano::VPiano( QWidget * parent, Qt::WindowFlags flags ) : QMainWindow(parent, flags), m_midiout(0), m_midiin(0), m_currentOut(-1), m_currentIn(-1), m_inputActive(false), m_midiThru(false) { ui.setupUi(this); ui.actionStatusBar->setChecked(false); connect(ui.actionAbout, SIGNAL(triggered()), SLOT(slotAbout())); connect(ui.actionAbout_Qt, SIGNAL(triggered()), SLOT(slotAboutQt())); connect(ui.actionConnections, SIGNAL(triggered()), SLOT(slotConnections())); connect(ui.actionPreferences, SIGNAL(triggered()), SLOT(slotPreferences())); connect(ui.actionLoadKM, SIGNAL(triggered()), SLOT(slotLoadKeyboardMap())); connect(ui.actionSaveKM, SIGNAL(triggered()), SLOT(slotSaveKeyboardMap())); connect(ui.actionEditKM, SIGNAL(triggered()), SLOT(slotEditKeyboardMap())); ui.pianokeybd->setPianoHandler(this); initialization(); }
MainWindow::MainWindow(CuteDesigner::Core *core) : QMainWindow(), ui(new Ui::MainWindow), m_core(core) { ui->setupUi(this); // defaultPageActions = ui->menuPage->actions(); // foreach (QAction * action, defaultPageActions) // action->setParent(this); ui->actionExport->setEnabled(m_core->reportCore()->exportModules().size()); // Initialise the global search widget StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker()); // ui->tabs->SetBackgroundPixmap(QPixmap(":/images/sidebar_background.png")); connect(ui->actionRender, SIGNAL(triggered()), core, SLOT(render()), Qt::QueuedConnection); connect(ui->actionRenderStop, SIGNAL(triggered()), core, SLOT(stopRenderer()), Qt::QueuedConnection); connect(ui->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(slotTabsSwitched(int))); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout())); connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT(slotOptions())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(m_core, SIGNAL(newReport_after(CuteReport::ReportInterface*)), this, SLOT(slotNewReport_after(CuteReport::ReportInterface*)), Qt::QueuedConnection); connect(m_core, SIGNAL(newPage_after(CuteReport::PageInterface*)), this, SLOT(slotNewPage_after(CuteReport::PageInterface*)), Qt::QueuedConnection); connect(m_core, SIGNAL(loadReport_after(CuteReport::ReportInterface*)), this, SLOT(slotLoadReport_after(CuteReport::ReportInterface*)), Qt::QueuedConnection); // connect(m_core, SIGNAL(newPageActions(QList<CuteReport::PageAction*>)), this, SLOT(slotNewPageActions(QList<CuteReport::PageAction*>)), Qt::QueuedConnection); connect(CuteReport::Log::instance(), SIGNAL(logMessage(CuteReport::LogLevel,QString,QString,QString)), ui->message, SLOT(pushMessage(CuteReport::LogLevel,QString,QString,QString))); connect(m_core->reportCore(), SIGNAL(rendererStarted(CuteReport::ReportInterface*)), ui->message, SLOT(clear())); // reloadSettings(); ui->geometryLabel->hide(); ui->coordinateLabel->hide(); m_updateTabTimer.setInterval(10); m_updateTabTimer.setSingleShot(true); connect(&m_updateTabTimer, SIGNAL(timeout()), this, SLOT(slotUpdateTabs())); }
ApplicationWindow::ApplicationWindow(Miro::Server& _server) : Super(0, "MainWindow"), server_(_server), listView_(new QListView(this, "list view")), timer_(new QTimer(this, "timer")) { //-----------// // init menu // //-----------// // file menu QPopupMenu* menuFile = new QPopupMenu(); menuBar()->insertItem("&File", menuFile); menuFile->insertItem("Resolve Channel Factory", this, SLOT(slotResolveFactory())); menuFile->insertSeparator(); menuFile->insertItem("Quit", this, SLOT(close())); // help menu QPopupMenu* menuHelp = new QPopupMenu(); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", menuHelp); menuHelp->insertItem("About PolicyEditor", this, SLOT(slotAbout())); menuHelp->insertItem("About Qt", this, SLOT(slotAboutQt())); // init view // listView_->setRootIsDecorated(true); listView_->addColumn("Object ID"); listView_->addColumn("Type"); connect(listView_, SIGNAL(rightButtonPressed(QListViewItem *, const QPoint&, int)), this, SLOT(contextMenu(QListViewItem *, const QPoint&, int))); setCentralWidget(listView_); timer_->start(1000); resolveFactory("NotifyEventChannelFactory"); }
void MainWindow::createActions() { exitAction=new QAction(QIcon(":/image/exit.ico"),tr("退出"),this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setToolTip(tr("退出软件")); connect(exitAction,SIGNAL(triggered()),this,SLOT(close())); aboutAction=new QAction(QIcon(":/image/about.ico"),tr("帮助"),this); aboutAction->setShortcut(tr("Ctrl+H")); aboutAction->setToolTip(tr("关于本软件")); connect(aboutAction,SIGNAL(triggered()),this,SLOT(slotAbout())); picAction=new QAction(QIcon(":/image/lrpic.ico"),tr("流程图"),this); picAction->setToolTip(tr("算法流程图")); picAction->setShortcut(tr("Ctrl+P")); connect(picAction,SIGNAL(triggered()),this,SLOT(slotPic())); pcAction=new QAction(QIcon(":/image/weima.ico"),tr("伪码"),this); pcAction->setToolTip(tr("算法的伪码")); pcAction->setShortcut(tr("Ctrl+P")); connect(pcAction,SIGNAL(triggered()),this,SLOT(slotPC())); }
int detailset::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: showtop((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: showcpu((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: showmem((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: slotshowtop((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: slotshowcpu((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: slotshowmem((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: slotOK(); break; case 7: slotAbout(); break; case 8: slotQuit(); break; default: ; } _id -= 9; } return _id; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); // Settings m_settings = new VSettings("org.hawaii.desktop"); connect(m_settings, SIGNAL(changed()), this, SLOT(settingsChanged())); // Connect signals connect(ui->actionNewTab, SIGNAL(triggered()), this, SLOT(slotNewTab())); connect(ui->actionNewWindow, SIGNAL(triggered()), this, SLOT(slotNewWindow())); connect(ui->actionCloseTab, SIGNAL(triggered()), this, SLOT(slotCloseCurrentTab())); connect(ui->actionOpenFileManager, SIGNAL(triggered()), this, SLOT(slotOpenFileManager())); connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(slotCopy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SLOT(slotPaste())); connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(slotFind())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(slotAbout())); connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(slotCloseTab(int))); // Start with a tab slotNewTab(); }
/* Constructor setups the GUI. */ QucsTranscalc::QucsTranscalc() { QWidget *centralWidget = new QWidget(this); setCentralWidget(centralWidget); // set application icon setWindowIcon(QPixmap(":/bitmaps/big.qucs.xpm")); setWindowTitle("Qucs Transcalc " PACKAGE_VERSION); // create file menu QMenu *fileMenu = new QMenu(tr("&File")); QAction *fileLoad = new QAction(tr("&Load"), this); fileLoad->setShortcut(Qt::CTRL+Qt::Key_L); fileMenu->addAction(fileLoad); connect(fileLoad, SIGNAL(activated()), SLOT(slotFileLoad())); QAction *fileSave = new QAction (tr("&Save"), this); fileSave->setShortcut(Qt::CTRL+Qt::Key_S); fileMenu->addAction(fileSave); connect(fileSave, SIGNAL(activated()), SLOT(slotFileSave())); fileMenu->addSeparator(); QAction *fileOption = new QAction (tr("&Options"), this); fileOption->setShortcut(Qt::CTRL+Qt::Key_O); fileMenu->addAction(fileOption); connect(fileOption, SIGNAL(activated()), SLOT(slotOptions())); fileMenu->addSeparator(); QAction *fileQuit = new QAction (tr("&Quit"), this); fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q); fileMenu->addAction(fileQuit); connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit())); // create execute menu QMenu *execMenu = new QMenu(tr("&Execute")); QAction *execCopy = new QAction(tr("&Copy to Clipboard"), this); execCopy->setShortcut(Qt::Key_F2); execMenu->addAction(execCopy); connect(execCopy, SIGNAL(activated()), SLOT(slotCopyToClipBoard())); QAction *execAnalyze = new QAction(tr("&Analyze"), this); execAnalyze->setShortcut(Qt::Key_F3); execMenu->addAction(execAnalyze); connect(execAnalyze, SIGNAL(activated()), SLOT(slotAnalyze())); QAction *execSynthesize = new QAction (tr("&Synthesize"), this); execSynthesize->setShortcut(Qt::Key_F4); execMenu->addAction(execSynthesize); connect(execSynthesize, SIGNAL(activated()), SLOT(slotSynthesize())); // create help menu QMenu *helpMenu = new QMenu(tr("&Help")); QAction *helpHelp = new QAction(tr("&Help"), this); helpHelp->setShortcut(Qt::Key_F1); helpMenu->addAction(helpHelp); connect(helpHelp, SIGNAL(activated()), SLOT(slotHelpIntro())); QAction *helpAbout = new QAction(tr("About"), this); helpMenu->addAction(helpAbout); connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout())); // setup menu bar menuBar()->addMenu(fileMenu); menuBar()->addMenu(execMenu); menuBar()->addSeparator(); menuBar()->addMenu(helpMenu); // === left // seletion combo and figure QVBoxLayout *vl = new QVBoxLayout(); // transmission line type choice QGroupBox * lineGroup = new QGroupBox (tr("Transmission Line Type")); tranType = new QComboBox (lineGroup); tranType->insertItem (0, tr("Microstrip Line")); tranType->insertItem (1, tr("Coplanar Waveguide")); tranType->insertItem (2, tr("Grounded Coplanar")); tranType->insertItem (3, tr("Rectangular Waveguide")); tranType->insertItem (4, tr("Coaxial Line")); tranType->insertItem (5, tr("Coupled Microstrip")); connect(tranType, SIGNAL(activated(int)), SLOT(slotSelectType(int))); // setup transmission line picture pix = new QLabel (lineGroup); pix->setPixmap(QPixmap(":/bitmaps/microstrip.png")); QVBoxLayout *vfig = new QVBoxLayout(); vfig->addWidget(tranType); vfig->addWidget(pix); vfig->setSpacing(3); lineGroup->setLayout(vfig); vl->addWidget(lineGroup); // init additional translations setupTranslations (); // set current mode mode = ModeMicrostrip; // === middle QVBoxLayout *vm = new QVBoxLayout(); vm->setSpacing (3); // substrate parameter box QGroupBox * substrate = new QGroupBox (tr("Substrate Parameters")); vm->addWidget(substrate); // Pass the GroupBox > create Grid layout > Add widgets > set layout createPropItems (substrate, TRANS_SUBSTRATE); // component parameter box QGroupBox * component = new QGroupBox (tr("Component Parameters")); vm->addWidget(component); createPropItems (component, TRANS_COMPONENT); // === right QVBoxLayout *vr = new QVBoxLayout(); vr->setSpacing (3); // physical parameter box QGroupBox * physical = new QGroupBox (tr("Physical Parameters")); vr->addWidget(physical); createPropItems (physical, TRANS_PHYSICAL); // analyze/synthesize buttons QHBoxLayout * h2 = new QHBoxLayout(); QPushButton * analyze = new QPushButton (tr("Analyze")); h2->addWidget(analyze); analyze->setToolTip(tr("Derive Electrical Parameters")); connect(analyze, SIGNAL(clicked()), SLOT(slotAnalyze())); QPushButton * synthesize = new QPushButton (tr("Synthesize")); h2->addWidget(synthesize); synthesize->setToolTip(tr("Compute Physical Parameters")); connect(synthesize, SIGNAL(clicked()), SLOT(slotSynthesize())); vr->addLayout(h2); // electrical parameter box QGroupBox * electrical = new QGroupBox (tr("Electrical Parameters")); vr->addWidget(electrical); createPropItems (electrical, TRANS_ELECTRICAL); calculated = new QGroupBox (tr("Calculated Results")); vr->addWidget(calculated); // status line //statBar = new QStatusBar (this); //QLabel * statText = new QLabel ("Ready.", statBar); statusBar()->showMessage (tr("Ready.")); //statBar->setFixedHeight (statText->height ()); //delete statText; QVBoxLayout *vmain = new QVBoxLayout(); QHBoxLayout *hmain = new QHBoxLayout(); hmain->addLayout(vl); hmain->addLayout(vm); hmain->addLayout(vr); vmain->addLayout(hmain); //vmain->addWidget(statBar); centralWidget->setLayout(vmain); // setup calculated result bix createResultItems (calculated); updateSelection (); // instantiate transmission lines TransLineTypes[0].line = new microstrip (); TransLineTypes[0].line->setApplication (this); TransLineTypes[1].line = new coplanar (); TransLineTypes[1].line->setApplication (this); TransLineTypes[2].line = new groundedCoplanar (); TransLineTypes[2].line->setApplication (this); TransLineTypes[3].line = new rectwaveguide (); TransLineTypes[3].line->setApplication (this); TransLineTypes[4].line = new coax (); TransLineTypes[4].line->setApplication (this); TransLineTypes[5].line = new c_microstrip (); TransLineTypes[5].line->setApplication (this); }
MainMenubar::MainMenubar (QMainWindow *mw) : QMenuBar (mw, "mainMenubar") { actions.setAutoDelete(FALSE); RcFile rcfile; QPixmap icon(finished); QAction *action = new QAction(this, "actionExit"); action->setMenuText(tr("E&xit")); action->setIconSet(icon); action->setAccel(Qt::CTRL+Qt::Key_Q); action->setStatusTip(tr("Quit Qtstalker (Ctrl+Q)")); action->setToolTip(tr("Quit Qtstalker (Ctrl+Q)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalExit())); actions.replace(Exit, action); icon = configure; action = new QAction(this, "actionOptions"); action->setMenuText(tr("Edit &Preferences")); action->setIconSet(icon); action->setStatusTip(tr("Modify user preferences (Ctrl+0)")); action->setToolTip(tr("Modify user preferences (Ctrl+0)")); connect(action, SIGNAL(activated()), mw, SLOT(slotOptions())); actions.replace(Options, action); icon = nav; bool b; rcfile.loadData(RcFile::ShowSidePanel, b); action = new QAction(this, "actionPanel"); action->setMenuText(tr("Side &Panel")); action->setIconSet(icon); action->setStatusTip(tr("Toggle side-panel view (Ctrl+1)")); action->setToolTip(tr("Toggle side-panel view (Ctrl+1)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), mw, SLOT(slotHideNav(bool))); actions.replace(SidePanel, action); icon = gridicon; rcfile.loadData(RcFile::Grid, b); action = new QAction(this, "actionGrid"); action->setMenuText(tr("Chart &Grid")); action->setIconSet(icon); action->setStatusTip(tr("Toggle chart grid (Ctrl+2)")); action->setToolTip(tr("Toggle chart grid (Ctrl+2)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalGrid(bool))); actions.replace(Grid, action); icon = scaletoscreen; rcfile.loadData(RcFile::ScaleToScreen, b); action = new QAction(this, "actionScale"); action->setMenuText(tr("&Scale To Screen")); action->setIconSet(icon); action->setStatusTip(tr("Scale chart to current screen data (Ctrl+3)")); action->setToolTip(tr("Scale chart to current screen data (Ctrl+3)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalScale(bool))); actions.replace(ScaleToScreen, action); icon = crosshair; rcfile.loadData(RcFile::Crosshairs, b); action = new QAction(this, "actionCrosshairs"); action->setMenuText(tr("Toggle &Crosshairs")); action->setIconSet(icon); action->setStatusTip(tr("Toggle crosshairs (Ctrl+4)")); action->setToolTip(tr("Toggle crosshairs (Ctrl+4)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalCrosshairs(bool))); actions.replace(Crosshairs, action); icon = co; rcfile.loadData(RcFile::DrawMode, b); action = new QAction(this, "actionDraw"); action->setMenuText(tr("Toggle &Draw Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle drawing mode (Ctrl+5)")); action->setToolTip(tr("Toggle drawing mode (Ctrl+5)")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalDraw(bool))); actions.replace(DrawMode, action); icon = papertrade; rcfile.loadData(RcFile::PaperTradeMode, b); action = new QAction(this, "actionPaperTrade"); action->setMenuText(tr("Toggle &Trade Mode")); action->setIconSet(icon); action->setStatusTip(tr("Toggle paper-trade mode")); action->setToolTip(tr("Toggle paper-trade mode")); action->setToggleAction(TRUE); action->setOn(b); connect(action, SIGNAL(toggled(bool)), this, SIGNAL(signalPaperTrade(bool))); actions.replace(PaperTrade, action); icon = indicator; action = new QAction(this, "actionNewIndicator"); action->setMenuText(tr("New &Indicator")); action->setIconSet(icon); action->setStatusTip(tr("Add new indicator (Ctrl+7)")); action->setToolTip(tr("Add new indicator (Ctrl+7)")); connect(action, SIGNAL(activated()), this, SIGNAL(signalNewIndicator())); actions.replace(NewIndicator, action); icon = datawindow; action = new QAction(this, "actionDataWindow"); action->setMenuText(tr("&Data Window")); action->setIconSet(icon); action->setAccel(Qt::ALT+Qt::Key_1); action->setStatusTip(tr("Show data window (Alt+1)")); action->setToolTip(tr("Show data window (Alt+1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotDataWindow())); actions.replace(DataWindow, action); icon = quotes; action = new QAction(this, "actionQuote"); action->setMenuText(tr("Load Quotes")); action->setIconSet(icon); action->setStatusTip(tr("Load Quotes (Ctrl+Y)")); action->setToolTip(tr("Load Quotes (Ctrl+Y)")); connect(action, SIGNAL(activated()), mw, SLOT(slotQuotes())); actions.replace(Quotes, action); icon = qtstalker; action = new QAction(this, "actionAbout"); action->setMenuText(tr("&About")); action->setIconSet(icon); action->setStatusTip(tr("About Qtstalker.")); action->setToolTip(tr("About Qtstalker.")); connect(action, SIGNAL(activated()), mw, SLOT(slotAbout())); actions.replace(About, action); icon = help; action = new QAction(this, "actionHelp"); action->setMenuText(tr("&Help")); action->setIconSet(icon); action->setAccel(Qt::Key_F1); action->setStatusTip(tr("Display Help (F1)")); action->setToolTip(tr("Display Help (F1)")); connect(action, SIGNAL(activated()), mw, SLOT(slotHelp())); actions.replace(Help, action); action = new QAction(this, "actionAdvancePaperTrade"); action->setAccel(Qt::CTRL+Qt::Key_Right); connect(action, SIGNAL(activated()), this, SIGNAL(signalAdvancePaperTrade())); actions.replace(AdvancePaperTrade, action); action = new QAction(this, "actionIndicatorSummary"); action->setMenuText(tr("Indicator Summary")); action->setStatusTip(tr("Indicator Summary")); action->setToolTip(tr("Indicator Summary")); connect(action, SIGNAL(activated()), mw, SLOT(slotIndicatorSummary())); actions.replace(IndicatorSummary, action); Q3Accel *a = new Q3Accel(mw); connect(a, SIGNAL(activated(int)), this, SLOT(slotAccel(int))); a->insertItem(Qt::CTRL+Qt::Key_0, Options); a->insertItem(Qt::CTRL+Qt::Key_1, SidePanel); a->insertItem(Qt::CTRL+Qt::Key_2, Grid); a->insertItem(Qt::CTRL+Qt::Key_3, ScaleToScreen); a->insertItem(Qt::CTRL+Qt::Key_4, Crosshairs); a->insertItem(Qt::CTRL+Qt::Key_5, DrawMode); a->insertItem(Qt::CTRL+Qt::Key_7, NewIndicator); a->insertItem(Qt::CTRL+Qt::Key_Y, Quotes); a->insertItem(Qt::CTRL+Qt::Key_Right, AdvancePaperTrade); a->insertItem(Qt::CTRL+Qt::Key_Escape, 8); createMenus(); rcfile.loadData(RcFile::ShowMenuBar, b); if (!b) hide(); }
QssEditor::QssEditor(QWidget *parent) : QWidget(parent), ui(new Ui::QssEditor), m_changed(false) { ui->setupUi(this); // some default values QHash<QString, QVariant> defaultValues; defaultValues.insert(SETTING_PREVIEW_DELAY, 750); Settings::instance()->addDefaultValues(defaultValues); resetWindowTitle(); // icons ui->toolOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/images/open.png"))); ui->toolSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/images/save.png"))); ui->toolSaveAs->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/saveas.png"))); ui->toolClose->setIcon(QIcon::fromTheme("window-close", QIcon(":/images/close.png"))); ui->toolUndo->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/images/undo.png"))); ui->toolRedo->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/images/redo.png"))); ui->toolOptions->setIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/options.png"))); // application shortcuts new QShortcut(QKeySequence::Quit, this, SLOT(slotQuit())); new QShortcut(QKeySequence::Find, this, SLOT(slotFind())); new QShortcut(QKeySequence::FindNext, this, SLOT(slotFindNext())); new QShortcut(QKeySequence::HelpContents, this, SLOT(slotAbout())); // shortcuts ui->toolOpen->setShortcut(QKeySequence::Open); ui->toolSave->setShortcut(QKeySequence::Save); ui->toolSaveAs->setShortcut(QKeySequence::SaveAs); ui->toolClose->setShortcut(QKeySequence::Close); // built-in Qt icon ui->toolAboutQt->setIcon(QIcon( #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) ":/qt-project.org/qmessagebox/images/qtlogo-64.png" #else ":/trolltech/qmessagebox/images/qtlogo-64.png" #endif )); // menu for toolbutton QMenu *toolButtonMenu = new QMenu(this); toolButtonMenu->addAction("Item1"); toolButtonMenu->addSeparator(); toolButtonMenu->addAction("Item2"); ui->toolButton->setMenu(toolButtonMenu); m_timerDelayedApply = new QTimer(this); m_timerDelayedApply->setSingleShot(true); connect(m_timerDelayedApply, SIGNAL(timeout()), this, SLOT(slotApplyCss())); resetPreviewDelay(); QTimer *timerProgress = new QTimer(this); timerProgress->setInterval(500); connect(timerProgress, SIGNAL(timeout()), this, SLOT(slotProgress())); timerProgress->start(); ui->splitter->setCollapsible(0, false); ui->splitter->setStretchFactor(0, 1); // splitter size QList<int> list = QList<int>() << width()/2 << width()/2; ui->splitter->setSizes(list); // some MDI windows QMdiSubWindow *mdi = ui->mdiArea->addSubWindow(new QLabel("MDI", ui->mdiArea)); mdi->resize(160, 80); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) ui->tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); #else ui->tree->header()->setResizeMode(QHeaderView::ResizeToContents); ui->table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); #endif ui->tree->topLevelItem(0)->setExpanded(true); ui->text->setCaretLineVisible(true); ui->text->setCaretLineBackgroundColor(QColor("gainsboro")); ui->text->setAutoIndent(true); ui->text->setIndentationGuides(false); ui->text->setIndentationsUseTabs(true); ui->text->setIndentationWidth(4); ui->text->setMarginsBackgroundColor(QColor("gainsboro")); ui->text->setMarginLineNumbers(1, true); ui->text->setMarginWidth(1, 50); ui->text->setAutoCompletionSource(QsciScintilla::AcsAll); ui->text->setAutoCompletionReplaceWord(true); ui->text->setAutoCompletionCaseSensitivity(false); ui->text->setAutoCompletionUseSingle(QsciScintilla::AcusAlways); ui->text->setAutoCompletionThreshold(0); ui->text->setBraceMatching(QsciScintilla::SloppyBraceMatch); ui->text->setMatchedBraceBackgroundColor(Qt::yellow); ui->text->setUnmatchedBraceForegroundColor(Qt::blue); // QSS lexer QsciLexerQSS *lexQss = new QsciLexerQSS(this); ui->text->setLexer(lexQss); ui->text->setFocus(); ui->text->installEventFilter(this); restoreLastFiles(); QTimer::singleShot(0, this, SLOT(slotDelayedOpen())); }
void QvvMainWindow::setupMenuBar() { /*--------------------------------------------------------------------*/ QMenu *menu; toolbar = new QToolBar( this ); toolbar->setVisible( opt_use_toolbar ? 1 : 0 ); menu = menuBar()->addMenu( tr("&File") ); QAction *action; /* action = menu->addAction(tr("Save layout...")); connect(action, SIGNAL(triggered()), this, SLOT(saveLayout())); action = menu->addAction(tr("Load layout...")); connect(action, SIGNAL(triggered()), this, SLOT(loadLayout())); action = menu->addAction(tr("Switch layout direction")); connect(action, SIGNAL(triggered()), this, SLOT(switchLayoutDirection())); menu->addSeparator(); */ action = menu->addAction( tr("&Reload directory"), this, SLOT(slotReloadDir()), Qt::Key_F5 ); action->setIcon( QIcon( ":/images/view-refresh.png" ) ); action = menu->addAction( tr("&Delete selected images"), this, SLOT(slotDeleteSelected()), Qt::Key_Delete ); //action->setIcon( QIcon( ":/images/view-refresh.png" ) ); action = menu->addAction( tr("&Quit"), this, SLOT(close()), Qt::AltModifier + Qt::Key_X ); action->setIcon( QIcon( ":/images/system-log-out.png" ) ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&View")); action = menu->addAction( tr("&Toggle toolbar"), this, SLOT(slotToggleToolbar()) ); action = menu->addAction( tr("Enable &thumbnails") ); action->setCheckable( true ); action->setChecked( opt_thumbs ); action->setShortcut( Qt::Key_F6 ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotThumbs()) ); action = menu->addAction( tr("Show d&irectories only") ); action->setCheckable( true ); action->setChecked( opt_dirs_only ); action->setShortcut( Qt::AltModifier + Qt::Key_I ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotShowDirsOnly()) ); menu->addSeparator(); action = menu->addAction( tr("Sort by &Name"), this, SLOT(slotSortColumn1()), Qt::AltModifier + Qt::Key_N ); action = menu->addAction( tr("Sort by &Modify Time"), this, SLOT(slotSortColumn3()), Qt::AltModifier + Qt::Key_M ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Go")); action = menu->addAction( tr("Go to p&arent directory"), this, SLOT(slotGoUp()), Qt::Key_Backspace ); action->setIcon( QIcon( ":/images/go-up.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("Change &directory"), this, SLOT(slotChangeDir()), Qt::AltModifier + Qt::Key_D ); action->setIcon( QIcon( ":/images/folder.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("Go to &home directory"), this, SLOT(slotHomeDir()), Qt::AltModifier + Qt::Key_Home ); action->setIcon( QIcon( ":/images/go-home.png" ) ); toolbar->addAction( action ); menu->addSeparator(); action = menu->addAction( tr("Go to &Random image"), this, SLOT(slotRandomItem()), Qt::Key_Asterisk ); action = menu->addAction( tr("Activate current item"), this, SLOT(enterCurrent()), Qt::Key_Right ); action = menu->addAction( tr("Display all &selected images"), this, SLOT(enterAllSelected()), Qt::ControlModifier + Qt::Key_Right ); action->setIcon( QIcon( ":/images/view_all.png" ) ); toolbar->addAction( action ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Window")); action = menu->addAction( tr("&New browser window"), this, SLOT(slotNewWindow()), Qt::Key_F3 ); action->setIcon( QIcon( ":/images/window-new.png" ) ); toolbar->addAction( action ); menu->addAction( tr("&Close window"), this, SLOT(close()), Qt::Key_F4 ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Settings")); action = menu->addAction( tr("Create thumbnails if needed") ); action->setCheckable( true ); action->setChecked( opt_create_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotCreateThumbs()) ); action = menu->addAction( tr("Create smooth thumbnails") ); action->setCheckable( true ); action->setChecked( opt_create_smooth_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotSmoothThumbs()) ); action = menu->addAction( tr("Create new thumbnails in JPEG for JPEGs") ); action->setCheckable( true ); action->setChecked( opt_create_jpeg_thumbs ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotJPEGThumbs()) ); menu->addSeparator(); action = menu->addAction( tr("Use toolbar upon startup") ); action->setCheckable( true ); action->setChecked( opt_use_toolbar ); connect( action, SIGNAL( toggled(bool) ), this, SLOT(slotUseToolbar()) ); /*--------------------------------------------------------------------*/ menu = menuBar()->addMenu( tr("&Help") ); action = menu->addAction( tr("&Help Contents"), this, SLOT(slotHelp()), Qt::Key_F1 ); action->setIcon( QIcon( ":/images/help-browser.png" ) ); toolbar->addAction( action ); action = menu->addAction( tr("&About"), this, SLOT(slotAbout()), Qt::AltModifier + Qt::Key_A ); action->setIcon( QIcon( ":/images/face-glasses.png" ) ); toolbar->addAction( action ); /*--------------------------------------------------------------------*/ addToolBar( toolbar ); }
/* Constructor setups the GUI. */ QucsLib::QucsLib() { // set application icon setIcon (QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm")); setCaption("Qucs Library Tool " PACKAGE_VERSION); QMenuBar * menuBar = new QMenuBar (this); // create file menu QPopupMenu * fileMenu = new QPopupMenu (); QAction * manageLib = new QAction ("Manage User Libraries...", tr("Manage User &Libraries..."), CTRL+Key_M, this); manageLib->addTo (fileMenu); connect(manageLib, SIGNAL(activated()), SLOT(slotManageLib())); fileMenu->insertSeparator(); QAction * fileQuit = new QAction ("Quit", tr("&Quit"), CTRL+Key_Q, this); fileQuit->addTo (fileMenu); connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit())); // create help menu QPopupMenu * helpMenu = new QPopupMenu (); QAction * helpHelp = new QAction (tr("Help"), tr("&Help"), Key_F1, this); helpHelp->addTo (helpMenu); connect(helpHelp, SIGNAL(activated()), SLOT(slotHelp())); QAction * helpAbout = new QAction (tr("About"), tr("About"), 0, helpMenu); helpAbout->addTo (helpMenu); connect(helpAbout, SIGNAL(activated()), SLOT(slotAbout())); // setup menu bar menuBar->insertItem (tr("&File"), fileMenu); menuBar->insertSeparator (); menuBar->insertItem (tr("&Help"), helpMenu); // main box QVBoxLayout * all = new QVBoxLayout (this); all->setSpacing (0); all->setMargin (0); // reserve space for menubar QWidget * Space = new QWidget (this); Space->setFixedSize(5, menuBar->height() + 2); all->addWidget (Space); // main layout QHBox * h = new QHBox (this); h->setSpacing (5); h->setMargin (3); all->addWidget (h); // library and component choice QVGroupBox * LibGroup = new QVGroupBox (tr("Component Selection"), h); Library = new QComboBox (LibGroup); connect(Library, SIGNAL(activated(int)), SLOT(slotSelectLibrary(int))); CompList = new QListBox(LibGroup); connect(CompList, SIGNAL(highlighted(QListBoxItem*)), SLOT(slotShowComponent(QListBoxItem*))); QHBox * h1 = new QHBox (LibGroup); QPushButton * SearchButton = new QPushButton (tr("Search..."), h1); connect(SearchButton, SIGNAL(clicked()), SLOT(slotSearchComponent())); h1->setStretchFactor(new QWidget(h1), 5); // stretchable placeholder // component display QVGroupBox *CompGroup = new QVGroupBox (tr("Component"), h); CompDescr = new QTextEdit(CompGroup); CompDescr->setTextFormat(Qt::PlainText); CompDescr->setReadOnly(true); CompDescr->setWordWrap(QTextEdit::NoWrap); Symbol = new SymbolWidget (CompGroup); QHBox * h2 = new QHBox (CompGroup); QPushButton * CopyButton = new QPushButton (tr("Copy to clipboard"), h2); connect(CopyButton, SIGNAL(clicked()), SLOT(slotCopyToClipBoard())); QPushButton * ShowButton = new QPushButton (tr("Show Model"), h2); connect(ShowButton, SIGNAL(clicked()), SLOT(slotShowModel())); // ...................................................... putLibrariesIntoCombobox(); }
kSwarmSetup::kSwarmSetup( QWidget *parent, const char *name ) : QDialog( parent, name, TRUE ) { readSettings(); setCaption( glocale->translate("Setup KSwarm") ); QLabel *label; QPushButton *button; KSlider *slider; QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); QHBoxLayout *tl1 = new QHBoxLayout; tl->addLayout(tl1); QVBoxLayout *tl11 = new QVBoxLayout(5); tl1->addLayout(tl11); label = new QLabel( glocale->translate("Speed:"), this ); min_size(label); tl11->addWidget(label); slider = new KSlider( KSlider::Horizontal, this ); slider->setMinimumSize( 90, 20 ); slider->setRange( MINSPEED, MAXSPEED ); slider->setSteps( (MAXSPEED-MINSPEED)/4, (MAXSPEED-MINSPEED)/2 ); slider->setValue( speed ); connect( slider, SIGNAL( valueChanged( int ) ), SLOT( slotSpeed( int ) ) ); tl11->addWidget(slider); tl11->addSpacing(5); label = new QLabel( glocale->translate("Number of Bees:"), this ); min_size(label); tl11->addWidget(label); slider = new KSlider( KSlider::Horizontal, this ); slider->setMinimumSize( 90, 20 ); slider->setRange( MINBATCH, MAXBATCH ); slider->setSteps( (MAXBATCH-MINBATCH)/4, (MAXBATCH-MINBATCH)/2 ); slider->setValue( maxLevels ); connect( slider, SIGNAL( valueChanged( int ) ), SLOT( slotLevels( int ) ) ); tl11->addWidget(slider); tl11->addStretch(1); preview = new QWidget( this ); preview->setFixedSize( 220, 170 ); preview->setBackgroundColor( black ); preview->show(); // otherwise saver does not get correct size saver = new kSwarmSaver( preview->winId() ); tl1->addWidget(preview); KButtonBox *bbox = new KButtonBox(this); button = bbox->addButton( glocale->translate("About")); connect( button, SIGNAL( clicked() ), SLOT(slotAbout() ) ); bbox->addStretch(1); button = bbox->addButton( glocale->translate("OK")); connect( button, SIGNAL( clicked() ), SLOT( slotOkPressed() ) ); button = bbox->addButton(glocale->translate("Cancel")); connect( button, SIGNAL( clicked() ), SLOT( reject() ) ); bbox->layout(); tl->addWidget(bbox); tl->freeze(); }
/*! * Setup the user interface */ void MainWindow::setupUi() { this->setMinimumSize(640, 480); this->resize(800, 600); actionAboutCaSSiS = new QAction(this); actionAboutQt = new QAction(this); actionOpenPhylogram = new QAction(this); actionOpenBGRT = new QAction(this); actionManualSearch = new QAction(this); actionSaveResults = new QAction(this); actionClose = new QAction(this); actionExit = new QAction(this); actionMatchSelection = new QAction(this); actionMarkResults = new QAction(this); centralwidget = new QWidget(this); verticalLayout = new QVBoxLayout(centralwidget); mainSplitter = new QSplitter(centralwidget); mainSplitter->setOrientation(Qt::Horizontal); treeView = new TreeView(mainSplitter); mainSplitter->addWidget(treeView); resultTab = new ResultTab(mainSplitter); mainSplitter->addWidget(resultTab); verticalLayout->addWidget(mainSplitter); this->setCentralWidget(centralwidget); menubar = new QMenuBar(this); menubar->setGeometry(QRect(0, 0, 800, 24)); menuFile = new QMenu(menubar); menuAbout = new QMenu(menubar); this->setMenuBar(menubar); statusbar = new QStatusBar(this); this->setStatusBar(statusbar); menubar->addAction(menuFile->menuAction()); menubar->addAction(menuAbout->menuAction()); // menuFile->addAction(actionOpenPhylogram); connect(actionOpenPhylogram, SIGNAL(triggered()), treeView, SLOT(slotOpenPhylo())); // menuFile->addAction(actionOpenBGRT); connect(actionOpenBGRT, SIGNAL(triggered()), resultTab, SLOT(slotOpenBGRT())); // menuFile->addSeparator(); menuFile->addAction(actionManualSearch); menuFile->addAction(actionMatchSelection); menuFile->addSeparator(); menuFile->addAction(actionMarkResults); menuFile->addAction(actionSaveResults); menuFile->addSeparator(); menuFile->addAction(actionClose); // menuFile->addAction(actionExit); connect(actionExit, SIGNAL(triggered()), this, SLOT(slotExit())); // menuAbout->addAction(actionAboutCaSSiS); connect(actionAboutCaSSiS, SIGNAL(triggered()), this, SLOT(slotAbout())); // menuAbout->addAction(actionAboutQt); connect(actionAboutQt, SIGNAL(triggered()), this, SLOT(slotAboutQt())); // connect(treeView, SIGNAL(triggerGroupMatch(const QStringList &)), resultTab, SLOT(slotGroupMatch(const QStringList &))); retranslateUi(); }
int qtbook::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: slotResizeColumns(); break; case 1: slotDisplaySummary(); break; case 2: slotExit(); break; case 3: slotAbout(); break; case 4: slotAllGo(); break; case 5: slotQuery(); break; case 6: slotReset(); break; case 7: slotDelete(); break; case 8: slotModify(); break; case 9: slotSearch(); break; case 10: slotRefresh(); break; case 11: slotRequest(); break; case 12: slotAddAdmin(); break; case 13: slotCheckout(); break; case 14: slotCDSearch(); break; case 15: slotInsertCD(); break; case 16: slotNextPage(); break; case 17: slotSaveUser(); break; case 18: slotSetFonts(); break; case 19: slotShowGrid(); break; case 20: slotShowMenu(); break; case 21: slotShowNext(); break; case 22: slotShowPrev(); break; case 23: slotConnectDB(); break; case 24: slotCopyError(); break; case 25: slotDVDSearch(); break; case 26: slotDuplicate(); break; case 27: slotInsertMag(); break; case 28: slotInsertDVD(); break; case 29: slotMagSearch(); break; case 30: slotPrintView(); break; case 31: slotBookSearch(); break; case 32: slotChangeView((*reinterpret_cast< bool(*)>(_a[1]))); break; case 33: slotDisconnect(); break; case 34: slotInsertBook(); break; case 35: slotSaveConfig(); break; case 36: slotSetColumns(); break; case 37: slotAddBorrower(); break; case 38: slotDeleteAdmin(); break; case 39: slotExportAsCSV(); break; case 40: slotJournSearch(); break; case 41: slotPageClicked((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 42: slotViewDetails(); break; case 43: slotReserveCopy(); break; case 44: slotShowColumns(); break; case 45: slotShowHistory(); break; case 46: slotInsertJourn(); break; case 47: slotPreviousPage(); break; case 48: slotRemoveMember(); break; case 49: slotSavePassword(); break; case 50: slotCancelAddUser(); break; case 51: slotBranchChanged(); break; case 52: slotPrintReserved(); break; case 53: slotResetErrorLog(); break; case 54: slotModifyBorrower(); break; case 55: slotSectionResized((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 56: slotAutoPopOnFilter(); break; case 57: slotClearSqliteMenu((*reinterpret_cast< bool(*)>(_a[1]))); break; case 58: slotGrantPrivileges(); break; case 59: slotInsertVideoGame(); break; case 60: slotShowAdminDialog(); break; case 61: slotShowCustomQuery(); break; case 62: slotShowErrorDialog(); break; case 63: slotVideoGameSearch(); break; case 64: slotListOverdueItems(); break; case 65: slotRefreshAdminList(); break; case 66: slotResetLoginDialog(); break; case 67: slotShowConnectionDB(); break; case 68: slotListReservedItems(); break; case 69: slotExecuteCustomQuery(); break; case 70: slotSaveAdministrators(); break; case 71: slotSelectDatabaseFile(); break; case 72: slotShowChangePassword(); break; case 73: slotShowDbEnumerations(); break; case 74: slotShowMembersBrowser(); break; case 75: slotSqliteFileSelected((*reinterpret_cast< bool(*)>(_a[1]))); break; case 76: slotCloseMembersBrowser(); break; case 77: slotAdminCheckBoxClicked((*reinterpret_cast< int(*)>(_a[1]))); break; case 78: slotSceneSelectionChanged(); break; case 79: slotCloseCustomQueryDialog(); break; case 80: slotDisplayNewSqliteDialog(); break; case 81: slotPopulateMembersBrowser(); break; case 82: slotResizeColumnsAfterSort(); break; case 83: slotUpdateIndicesAfterSort((*reinterpret_cast< int(*)>(_a[1]))); break; case 84: slotPrintReservationHistory(); break; default: ; } _id -= 85; } return _id; }
PolicyEditorClass::PolicyEditorClass(int argc, char** argv, Miro::Client& _client) : QMainWindow(NULL, "PolicyEditor"), client_(_client), miroRoot_(getenv("MIRO_ROOT")), policyFileName_("_"), robot_(getenv("HOST")) { resize(600, 500); //-----------// // init menu // //-----------// // file menu QPopupMenu* MenuFile = new QPopupMenu(); menuBar()->insertItem("&File", MenuFile); MenuFile->insertItem("New", this, SLOT(slotNew())); MenuFile->insertItem("Open ...", this, SLOT(slotLoad())); MenuFile->insertItem("Save", this, SLOT(slotSave())); MenuFile->insertItem("Save As ...", this, SLOT(slotSaveAs())); MenuFile->insertSeparator(); MenuFile->insertItem("Send to ...", this, SLOT(slotSendTo())); MenuFile->insertSeparator(); MenuFile->insertItem("Quit", this, SLOT(quit())); // options menue QPopupMenu* MenuOptions = new QPopupMenu(); menuBar()->insertItem("&Options", MenuOptions); //MenuOptions->insertItem("&Configuration ..", this, SLOT(slotConfiguration())); // MenuEdit->insertItem("Add Basic Behaviour ..", this, NULL); MenuOptions->insertItem("&Behaviour-Description-Filename..", this, SLOT(getBehaviourDescriptionFileName())); MenuOptions->insertItem("&Load Behaviour-Description-Filename..", this, SLOT(setBehaviourDescriptionFileName())); // help menu QPopupMenu* MenuHelp = new QPopupMenu(); menuBar()->insertSeparator(); menuBar()->insertItem("&Help", MenuHelp); MenuHelp->insertItem("About PolicyEditor", this, SLOT(slotAbout())); MenuHelp->insertItem("About Qt", this, SLOT(slotAboutQt())); //---------------// // init document // //---------------// // load database file document_.loadDatabase("behaviours.dat"); document_.setModified(false); // if given -> load policy file if (argc > 1) { document_.loadXML(argv[1]); policyFileName_=argv[1]; statusBar()->message(policyFileName_+" geladen!", 1000); } else { document_.loadXML(miroRoot_ + "/etc/PolicyEditorNewFile.xml"); document_.setModified(false); setCaption("new document"); policyFileName_="_"; QString message; message.sprintf("New document opend"); statusBar()->message(message, 3000); } //-----------// // init view // //-----------// view_ = new PolicyViewClass(this, document_); setCentralWidget(view_); #ifdef ASDF // load pattern database // QMessageBox::information(this, "Policy Editor", "Hallo,\n\nfirst, you have to select your\nbehaviour database ..."); QString filename = QFileDialog::getOpenFileName(0, "*.dat", this); if (filename.isNull()) { std::cout << "database must be chosen !" << std::endl; exit(0); } document_.LoadDatabase(string(filename)); #endif }