CodeArea::CodeArea(QWidget *parent) : QMdiArea(parent), fontSize(10) //TODO make a const { //set up left and right actions to shuffle through buffers QAction *leftAction = new QAction(this); leftAction->setShortcut( tr("Alt+Left") ); QAction *rightAction = new QAction(this); rightAction->setShortcut( tr("Alt+Right") ); connect( leftAction, SIGNAL(triggered()), this, SLOT(activatePreviousSubWindow()) ); connect( rightAction, SIGNAL(triggered()), this, SLOT(activateNextSubWindow()) ); addAction(leftAction); addAction(rightAction); //forward selection changes in mdi connect( this, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(fireSelectRevision(QMdiSubWindow*)) ); //setup subWindowList() to return stacking order //this is to facilitate always getting top window for execution setActivationOrder( QMdiArea::StackingOrder ); }
void XmdvToolMainWnd::initWindowActions() { action_Close = new QAction(tr("Cl&ose"), this); action_Close->setShortcut(tr("Ctrl+F4")); action_Close->setStatusTip(tr("Close the active window")); connect(action_Close, SIGNAL(triggered()), m_mdiArea, SLOT(closeActiveSubWindow())); action_CloseAll = new QAction(tr("Close &All"), this); action_CloseAll->setStatusTip(tr("Close all the windows")); connect(action_CloseAll, SIGNAL(triggered()), m_mdiArea, SLOT(closeAllSubWindows())); action_Tile = new QAction(tr("&Tile"), this); action_Tile->setStatusTip(tr("Tile the windows")); connect(action_Tile, SIGNAL(triggered()), m_mdiArea, SLOT(tileSubWindows())); action_Cascade = new QAction(tr("&Cascade"), this); action_Cascade->setStatusTip(tr("Cascade the windows")); connect(action_Cascade, SIGNAL(triggered()), m_mdiArea, SLOT(cascadeSubWindows())); action_Next = new QAction(tr("Ne&xt"), this); action_Next->setShortcut(tr("Ctrl+F6")); action_Next->setStatusTip(tr("Move the focus to the next window")); connect(action_Next, SIGNAL(triggered()), m_mdiArea, SLOT(activateNextSubWindow())); action_Previous = new QAction(tr("Pre&vious"), this); action_Previous->setShortcut(tr("Ctrl+Shift+F6")); action_Previous->setStatusTip(tr("Move the focus to the previous window")); connect(action_Previous, SIGNAL(triggered()), m_mdiArea, SLOT(activatePreviousSubWindow())); action_Separator = new QAction(this); action_Separator->setSeparator(true); }
MdiContainerWidgetTaskMenu::MdiContainerWidgetTaskMenu(QMdiArea *m, QObject *parent) : ContainerWidgetTaskMenu(m, MdiContainer, parent) { initializeActions(); connect(m_nextAction, SIGNAL(triggered()), m, SLOT(activateNextSubWindow())); connect(m_previousAction, SIGNAL(triggered()), m , SLOT(activatePreviousSubWindow())); connect(m_tileAction, SIGNAL(triggered()), m, SLOT(tileSubWindows())); connect(m_cascadeAction, SIGNAL(triggered()), m, SLOT(cascadeSubWindows())); }
void XArch::createActions() { newAct = new QAction(tr("&New..."), this); newAct->setShortcut(QKeySequence(tr("Ctrl+N"))); connect(newAct, SIGNAL(triggered()), this, SLOT(on_newAct())); settingsAct = new QAction(tr("Se&ttings..."), this); connect(settingsAct, SIGNAL(triggered()), this, SLOT(on_settingsAct())); testAct = new QAction(tr("&Test"), this); testAct->setShortcut(QKeySequence(tr("Ctrl+T"))); connect(testAct, SIGNAL(triggered()), this, SLOT(on_testAct())); closeAct = new QAction(tr("Cl&ose"), this); connect(closeAct, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); closeAllAct = new QAction(tr("Close &All"), this); connect(closeAllAct, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); nextAct = new QAction(tr("Ne&xt"), this); nextAct->setShortcuts(QKeySequence::NextChild); connect(nextAct, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); previousAct = new QAction(tr("Pre&vious"), this); previousAct->setShortcuts(QKeySequence::PreviousChild); connect(previousAct, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); separatorAct = new QAction(this); separatorAct->setSeparator(true); showDictsAct = new QAction(tr("&Dictionaries..."), this); connect(showDictsAct, SIGNAL(triggered()), this, SLOT(on_showDictsAct())); showTemplatesAct = new QAction(tr("&Templates..."), this); connect(showTemplatesAct, SIGNAL(triggered()), this, SLOT(on_showTemplatesAct())); searchDbAct = new QAction(tr("Searc&h database..."), this); searchDbAct->setShortcut(QKeySequence(tr("Ctrl+F"))); connect(searchDbAct, SIGNAL(triggered()), this, SLOT(on_searchDbAct())); printAct = new QAction(tr("Print..."), this); printAct->setShortcut(QKeySequence(tr("Ctrl+P"))); connect(printAct, SIGNAL(triggered()), this, SLOT(on_printAct())); dailyReportAct = new QAction(tr("Daily report..."), this); connect(dailyReportAct, SIGNAL(triggered()), this, SLOT(on_dailyReportAct())); }
void MainWindow::createActions() { newAction = new QAction(tr("&New"), this); newAction->setIcon(QIcon(":/images/filenew.png")); newAction->setShortcut(QKeySequence::New); newAction->setStatusTip(tr("Create a new file")); connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); openAction = new QAction(tr("&Open..."), this); openAction->setIcon(QIcon(":/images/fileopen.png")); openAction->setShortcut(QKeySequence::Open); openAction->setStatusTip(tr("Open an existing file")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); printAction = new QAction(QIcon(":/images/fileprint.png"), tr("&Print"), this); printAction->setShortcut(QKeySequence::Print); printAction->setStatusTip(tr("Print File")); connect(printAction, SIGNAL(triggered()), this, SLOT(print())); saveAction = new QAction(tr("&Save"), this); saveAction->setIcon(QIcon(":/images/filesave.png")); saveAction->setShortcut(QKeySequence::Save); saveAction->setStatusTip(tr("Save the file to disk")); connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); saveAsAction = new QAction(tr("Save &As..."), this); saveAsAction->setIcon(QIcon(":/images/filesave.png")); saveAsAction->setStatusTip(tr("Save the file under a new name")); connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); exitAction = new QAction(tr("&Quit..."), this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("Exit the application")); connect(exitAction, SIGNAL(triggered()), this, SLOT(closep())); cutAction = new QAction(tr("Cu&t"), this); cutAction->setIcon(QIcon(":/images/editcut.png")); cutAction->setShortcut(QKeySequence::Cut); cutAction->setStatusTip(tr("Cut the current selection to the clipboard")); connect(cutAction, SIGNAL(triggered()), this, SLOT(cut())); copyAction = new QAction(tr("&Copy"), this); copyAction->setIcon(QIcon(":/images/editcopy.png")); copyAction->setShortcut(QKeySequence::Copy); copyAction->setStatusTip(tr("Copy the current selection to the clipboard")); connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); pasteAction = new QAction(tr("&Paste"), this); pasteAction->setIcon(QIcon(":/images/editpaste.png")); pasteAction->setShortcut(QKeySequence::Paste); pasteAction->setStatusTip(tr("Paste the clipboard's contents at the cursor position")); connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); //---------------------------------------------------------- textBoldAction = new QAction(QIcon(":/images/textbold.png"), tr("&Bold"), this); textBoldAction->setShortcut(Qt::CTRL + Qt::Key_B); textBoldAction->setStatusTip(tr("Text Bold")); QFont bold; bold.setBold(true); textBoldAction->setFont(bold); textBoldAction->setCheckable(true); connect(textBoldAction, SIGNAL(triggered()), this, SLOT(textBold())); textItalicAction = new QAction(QIcon(":/images/textitalic.png"), tr("&Italic"), this); textItalicAction->setShortcut(Qt::CTRL + Qt::Key_I); textItalicAction->setStatusTip(tr("Text Italic")); QFont italic; italic.setItalic(true); textItalicAction->setFont(italic); textItalicAction->setCheckable(true); connect(textItalicAction, SIGNAL(triggered()), this, SLOT(textItalic())); textUnderlineAction = new QAction(QIcon(":/images/textunder.png"), tr("&Underline"), this); textUnderlineAction->setShortcut(Qt::CTRL + Qt::Key_U); textUnderlineAction->setStatusTip(tr("Text Underline")); QFont underline; underline.setUnderline(true); textUnderlineAction->setFont(underline); textUnderlineAction->setCheckable(true); connect(textUnderlineAction, SIGNAL(triggered()), this, SLOT(textUnderline())); QPixmap pix(16, 16); pix.fill(Qt::black); textColorAction = new QAction(pix, tr("&Color..."), this); textColorAction->setStatusTip(tr("Select Text Color")); connect(textColorAction, SIGNAL(triggered()), this, SLOT(textColor())); //create font toolbar toolbFont = new QToolBar(this); toolbFont->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea); toolbFont->setWindowTitle(tr("Format Actions")); addToolBarBreak(Qt::TopToolBarArea); //addToolBar(toolbFont); //moved to createtoolbar //create fontcombobox comboFont = new QFontComboBox(toolbFont); toolbFont->addWidget(comboFont); comboFont->setToolTip("Set Font Type"); comboFont->setStatusTip("Select Font Type"); connect(comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &))); //create fontsize combobox comboSize = new QComboBox(toolbFont); comboSize->setObjectName("comboSize"); toolbFont->addWidget(comboSize); comboSize->setToolTip("Set Font Size"); comboSize->setStatusTip("Select Font Size"); comboSize->setEditable(true); QFontDatabase db; foreach(int size, db.standardSizes()) comboSize->addItem(QString::number(size)); connect(comboSize, SIGNAL(activated(const QString &)), this, SLOT(textSize(const QString &))); comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font().pointSize()))); setFontAction = new QAction(tr("&Font"), this); setFontAction->setShortcut(Qt::CTRL + Qt::Key_F); setFontAction->setStatusTip(tr("Set Font")); connect(setFontAction, SIGNAL(triggered()), this, SLOT(setFont())); //---------------------------------------------------------- inputAction = new QAction(tr("Input"), this); inputAction->setShortcut(Qt::CTRL + Qt::Key_A); inputAction->setStatusTip(tr("Select Input Paramerters")); connect(inputAction, SIGNAL(triggered()), this, SLOT(inputparameters())); output1Action = new QAction(tr("Output1"), this); output1Action->setShortcut(Qt::CTRL + Qt::Key_R); output1Action->setStatusTip(tr("Output 1")); connect(output1Action, SIGNAL(triggered()), this, SLOT(output1())); output2Action = new QAction(tr("Output2"), this); output2Action->setShortcut(Qt::CTRL + Qt::Key_T); output2Action->setStatusTip(tr("Output 2")); connect(output2Action, SIGNAL(triggered()), this, SLOT(output2())); //---------------------------------------------------------- closeAction = new QAction(tr("Cl&ose"), this); closeAction->setShortcut(QKeySequence::Close); closeAction->setStatusTip(tr("Close the active window")); connect(closeAction, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); closeAllAction = new QAction(tr("Close &All"), this); closeAllAction->setStatusTip(tr("Close all windows")); connect(closeAllAction, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); tileAction = new QAction(tr("&Tile"), this); tileAction->setStatusTip(tr("Tile the windows")); connect(tileAction, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); cascadeAction = new QAction(tr("&Cascade"), this); cascadeAction->setStatusTip(tr("Cascade the windows")); connect(cascadeAction, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); nextAction = new QAction(tr("Ne&xt"), this); nextAction->setShortcut(QKeySequence::NextChild); nextAction->setStatusTip(tr("Move the focus to the next window")); connect(nextAction, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); previousAction = new QAction(tr("Pre&vious"), this); previousAction->setShortcut(QKeySequence::PreviousChild); previousAction->setStatusTip(tr("Move the focus to the previous window")); connect(previousAction, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); separatorAction = new QAction(this); separatorAction->setSeparator(true); aboutAction = new QAction(tr("&About"), this); aboutAction->setStatusTip(tr("the application's About box")); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("the Qt library's About box")); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); windowActionGroup = new QActionGroup(this); }
QAction *MainWindow::createAction(const QString icon, const QString toolTip, const QString statusTip, bool scripted) { QAction *ACTION = new QAction(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + icon + ".png"), toolTip, this); //TODO: Qt4.7 wont load icons without an extension... ACTION->setStatusTip(statusTip); ACTION->setObjectName(icon); // TODO: Set What's This Context Help to statusTip for now so there is some infos there. // Make custom whats this context help popup with more descriptive help than just // the status bar/tip one liner(short but not real long) with a hyperlink in the custom popup // at the bottom to open full help file description. Ex: like wxPython AGW's SuperToolTip. ACTION->setWhatsThis(statusTip); // TODO: Finish All Commands ... <.< if (icon == "donothing") connect(ACTION, SIGNAL(triggered()), this, SLOT(doNothing())); else if(icon == "new") { ACTION->setShortcut(QKeySequence::New); connect(ACTION, SIGNAL(triggered()), this, SLOT(newFile())); } else if(icon == "open") { ACTION->setShortcut(QKeySequence::Open); connect(ACTION, SIGNAL(triggered()), this, SLOT(openFile())); } else if(icon == "save") { ACTION->setShortcut(QKeySequence::Save); connect(ACTION, SIGNAL(triggered()), this, SLOT(savefile())); } else if(icon == "saveas") { ACTION->setShortcut(QKeySequence::SaveAs); connect(ACTION, SIGNAL(triggered()), this, SLOT(saveasfile())); } else if(icon == "print") { ACTION->setShortcut(QKeySequence::Print); connect(ACTION, SIGNAL(triggered()), this, SLOT(print())); } else if(icon == "designdetails") { ACTION->setShortcut(QKeySequence("Ctrl+D")); connect(ACTION, SIGNAL(triggered()), this, SLOT(designDetails())); } else if(icon == "exit") { ACTION->setShortcut(QKeySequence("Ctrl+Q")); connect(ACTION, SIGNAL(triggered()), this, SLOT(exit())); } else if(icon == "cut") { ACTION->setShortcut(QKeySequence::Cut); connect(ACTION, SIGNAL(triggered()), this, SLOT(cut())); } else if(icon == "copy") { ACTION->setShortcut(QKeySequence::Copy); connect(ACTION, SIGNAL(triggered()), this, SLOT(copy())); } else if(icon == "paste") { ACTION->setShortcut(QKeySequence::Paste); connect(ACTION, SIGNAL(triggered()), this, SLOT(paste())); } else if(icon == "windowcascade") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(cascade())); else if(icon == "windowtile") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(tile())); else if(icon == "windowclose") { ACTION->setShortcut(QKeySequence::Close); connect(ACTION, SIGNAL(triggered()), this, SLOT(onCloseWindow())); } else if(icon == "windowcloseall") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); else if(icon == "windownext") { ACTION->setShortcut(QKeySequence::NextChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); } else if(icon == "windowprevious") { ACTION->setShortcut(QKeySequence::PreviousChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); } else if(icon == "help") connect(ACTION, SIGNAL(triggered()), this, SLOT(help())); else if(icon == "changelog") connect(ACTION, SIGNAL(triggered()), this, SLOT(changelog())); else if(icon == "tipoftheday") connect(ACTION, SIGNAL(triggered()), this, SLOT(tipOfTheDay())); else if(icon == "about") connect(ACTION, SIGNAL(triggered()), this, SLOT(about())); else if(icon == "whatsthis") connect(ACTION, SIGNAL(triggered()), this, SLOT(whatsThisContextHelp())); else if(icon == "icon16") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon16())); else if(icon == "icon24") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon24())); else if(icon == "icon32") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon32())); else if(icon == "icon48") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon48())); else if(icon == "icon64") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon64())); else if(icon == "icon128") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon128())); else if(icon == "settingsdialog") connect(ACTION, SIGNAL(triggered()), this, SLOT(settingsDialog())); else if(icon == "undo") connect(ACTION, SIGNAL(triggered()), this, SLOT(undo())); else if(icon == "redo") connect(ACTION, SIGNAL(triggered()), this, SLOT(redo())); else if(icon == "makelayercurrent") connect(ACTION, SIGNAL(triggered()), this, SLOT(makeLayerActive())); else if(icon == "layers") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerManager())); else if(icon == "layerprevious") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerPrevious())); else if(icon == "textbold") { ACTION->setCheckable(true); connect(ACTION, SIGNAL(toggled(bool)), this, SLOT(setTextBold(bool))); }
void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setIcon(QIcon(ICON(open.png))); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAct = new QAction(tr("&Save..."), this); saveAct->setShortcuts(QKeySequence::Save); saveAct->setIcon(QIcon(ICON(save.png))); saveAct->setStatusTip(tr("Save an existing file")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcuts(QKeySequence::Quit); exitAct->setIcon(QIcon(ICON(exit.png))); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); removeAllWidget = new QAction(tr("Clear"), this); removeAllWidget->setShortcuts(QKeySequence::Quit); removeAllWidget->setStatusTip(tr("Remove all widget from the buffer store")); connect(removeAllWidget, SIGNAL(triggered()), this, SLOT(clearBufor())); zoomInAct = new QAction(tr("Zoom In"), this); zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setIcon(QIcon(ICON(ZoomIn.png))); zoomInAct->setStatusTip(tr("Zoom in an image")); zoomOutAct = new QAction(tr("Zoom Out"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setIcon(QIcon(ICON(zoomout.png))); zoomOutAct->setStatusTip(tr("Zoom out an image")); zoomResetAct = new QAction(tr("Normal Size"), this); zoomResetAct->setShortcut(tr("Ctrl+=")); fitToWindowAct = new QAction(tr("Fit to Window"), this); fitToWindowAct->setCheckable(true); fitToWindowAct->setShortcut(tr("Ctrl+F")); openAllAct = new QAction(tr("Open the selected windows"), this); openAllAct->setCheckable(true); connect(openAllAct, SIGNAL(triggered()), this, SLOT(showItem())); closeAct = new QAction(tr("Cl&ose"), this); closeAct->setStatusTip(tr("Close the active window")); connect(closeAct, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); closeAllAct = new QAction(tr("Close &All"), this); closeAllAct->setStatusTip(tr("Close all the windows")); connect(closeAllAct, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); tileAct = new QAction(tr("&Tile"), this); tileAct->setStatusTip(tr("Tile the windows")); connect(tileAct, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); cascadeAct = new QAction(tr("&Cascade"), this); cascadeAct->setStatusTip(tr("Cascade the windows")); connect(cascadeAct, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); nextAct = new QAction(tr("Ne&xt"), this); nextAct->setShortcuts(QKeySequence::NextChild); nextAct->setStatusTip(tr("Move the focus to the next window")); connect(nextAct, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); previousAct = new QAction(tr("Pre&vious"), this); previousAct->setShortcuts(QKeySequence::PreviousChild); previousAct->setStatusTip(tr("Move the focus to the previous " "window")); connect(previousAct, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); windowActionGroup = new QActionGroup(this); //tylko jedna pozycja w menu jest sprawdzana separatorAct = new QAction(this); separatorAct->setSeparator(true); }
QAction *MainWindow::createAction(const QString icon, const QString toolTip, const QString statusTip, bool scripted) { QAction *ACTION = new QAction(QIcon("icons/" + getSettingsGeneralIconTheme() + "/" + icon + ".png"), toolTip, this); //TODO: Qt4.7 wont load icons without an extension... ACTION->setStatusTip(statusTip); ACTION->setObjectName(icon); // TODO: Finish All Commands ... <.< if (icon == "donothing") connect(ACTION, SIGNAL(triggered()), this, SLOT(doNothing())); else if(icon == "new") { ACTION->setShortcut(QKeySequence::New); connect(ACTION, SIGNAL(triggered()), this, SLOT(newfile())); } else if(icon == "open") { ACTION->setShortcut(QKeySequence::Open); connect(ACTION, SIGNAL(triggered()), this, SLOT(openfile())); } else if(icon == "save") { ACTION->setShortcut(QKeySequence::Save); connect(ACTION, SIGNAL(triggered()), this, SLOT(savefile())); } else if(icon == "saveas") { ACTION->setShortcut(QKeySequence::SaveAs); connect(ACTION, SIGNAL(triggered()), this, SLOT(saveasfile())); } else if(icon == "print") { ACTION->setShortcut(QKeySequence::Print); connect(ACTION, SIGNAL(triggered()), this, SLOT(print())); } else if(icon == "close") { ACTION->setShortcut(QKeySequence::Close); connect(ACTION, SIGNAL(triggered()), this, SLOT(onCloseWindow())); } else if(icon == "designdetails") { ACTION->setShortcut(QKeySequence("Ctrl+D")); connect(ACTION, SIGNAL(triggered()), this, SLOT(designDetails())); } else if(icon == "exit") { ACTION->setShortcut(QKeySequence("Ctrl+Q")); connect(ACTION, SIGNAL(triggered()), this, SLOT(exit())); } else if(icon == "cut") { ACTION->setShortcut(QKeySequence::Cut); connect(ACTION, SIGNAL(triggered()), this, SLOT(cut())); } else if(icon == "copy") { ACTION->setShortcut(QKeySequence::Copy); connect(ACTION, SIGNAL(triggered()), this, SLOT(copy())); } else if(icon == "paste") { ACTION->setShortcut(QKeySequence::Paste); connect(ACTION, SIGNAL(triggered()), this, SLOT(paste())); } else if(icon == "windowcascade") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(cascade())); else if(icon == "windowtile") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(tile())); else if(icon == "windowcloseall") connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); else if(icon == "windownext") { ACTION->setShortcut(QKeySequence::NextChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); } else if(icon == "windowprevious") { ACTION->setShortcut(QKeySequence::PreviousChild); connect(ACTION, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); } else if(icon == "help") connect(ACTION, SIGNAL(triggered()), this, SLOT(help())); else if(icon == "changelog") connect(ACTION, SIGNAL(triggered()), this, SLOT(changelog())); else if(icon == "tipoftheday") connect(ACTION, SIGNAL(triggered()), this, SLOT(tipOfTheDay())); else if(icon == "about") connect(ACTION, SIGNAL(triggered()), this, SLOT(about())); else if(icon == "aboutQt") connect(ACTION, SIGNAL(triggered()), qApp, SLOT(aboutQt())); else if(icon == "icon16") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon16())); else if(icon == "icon24") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon24())); else if(icon == "icon32") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon32())); else if(icon == "icon48") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon48())); else if(icon == "icon64") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon64())); else if(icon == "icon128") connect(ACTION, SIGNAL(triggered()), this, SLOT(icon128())); else if(icon == "settingsdialog") connect(ACTION, SIGNAL(triggered()), this, SLOT(settingsDialog())); else if(icon == "undo") connect(ACTION, SIGNAL(triggered()), this, SLOT(undo())); else if(icon == "redo") connect(ACTION, SIGNAL(triggered()), this, SLOT(redo())); else if(icon == "makelayercurrent") connect(ACTION, SIGNAL(triggered()), this, SLOT(makeLayerActive())); else if(icon == "layers") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerManager())); else if(icon == "layerprevious") connect(ACTION, SIGNAL(triggered()), this, SLOT(layerPrevious())); else if(icon == "textbold") { ACTION->setCheckable(true); connect(ACTION, SIGNAL(toggled(bool)), this, SLOT(setTextBold(bool))); }
void SVPlotMainWindow::SVPlotMainWindowPrivate::setupActions() { // // "File"-menu // actionNew = new QAction("&New", mw); actionNew->setIcon(QIcon(":icons/document-new.png")); actionNew->setShortcut(QKeySequence::New); connect(actionNew, SIGNAL(triggered()), mw, SLOT(newSubWindow())); actionLoad = new QAction("&Open", mw); actionLoad->setIcon(QIcon(":icons/document-open.png")); actionLoad->setShortcut(QKeySequence::Open); connect(actionLoad, SIGNAL(triggered()), mw, SLOT(load())); actionPrint = new QAction("&Print", mw); actionPrint->setIcon(QIcon(":icons/document-print.png")); actionPrint->setShortcut(QKeySequence::Print); actionPrint->setEnabled(false); connect(actionPrint, SIGNAL(triggered()), mw, SLOT(print())); actionQuit = new QAction("&Quit", mw); #if QT_VERSION >= 0x040600 actionQuit->setShortcut(QKeySequence::Quit); #else actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); #endif connect(actionQuit, SIGNAL(triggered()), mw, SLOT(close())); // // "Plot"-menu // actionZoomFit = new QAction("Fit to Window", mw); actionZoomFit->setIcon(QIcon(":icons/zoom-fit-best.png")); actionZoomFit->setEnabled(false); connect(actionZoomFit, SIGNAL(triggered()), mw, SLOT(zoomFit())); actionZoom = new QAction("&Zoom", mw); actionZoom->setIcon(QIcon(":icons/page-zoom.png")); actionZoom->setCheckable(true); actionZoom->setEnabled(false); connect(actionZoom, SIGNAL(toggled(bool)), mw, SLOT(setZoomEnabled(bool))); actionMove = new QAction("&Move", mw); actionMove->setIcon(QIcon(":icons/input-mouse.png")); actionMove->setCheckable(true); actionMove->setChecked(false); actionMove->setEnabled(false); connect(actionMove, SIGNAL(toggled(bool)), mw, SLOT(setMoveEnabled(bool))); actionZoom->setChecked(true); actionGroupZoomMove = new QActionGroup(mw); actionGroupZoomMove->addAction(actionZoom); actionGroupZoomMove->addAction(actionMove); // // "Window"-menu // actionPreviousPlot = new QAction("&Previous Plot", mw); actionPreviousPlot->setShortcut(QKeySequence::PreviousChild); connect(actionPreviousPlot, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); actionNextPlot = new QAction("&Next Plot", mw); actionNextPlot->setShortcut(QKeySequence::NextChild); connect(actionNextPlot, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); actionCascadePlots = new QAction("C&ascade Plots", mw); connect(actionCascadePlots, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); actionTilePlots = new QAction("&Tile Plots", mw); connect(actionTilePlots, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); actionClosePlot = new QAction("&Close Current Plot", mw); actionClosePlot->setShortcut(QKeySequence::Close); connect(actionClosePlot, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); actionCloseAllPlots = new QAction("Close &All Plots", mw); connect(actionCloseAllPlots, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); // // "Help"-menu // actionAbout = new QAction("&About", mw); connect(actionAbout, SIGNAL(triggered()), mw, SLOT(about())); }
void SVImageMainWindow::SVImageMainWindowPrivate::setupActions() { // // "File"-menu // actionLoad = new QAction("&Open", mw); actionLoad->setIcon(QIcon(":icons/document-open.png")); actionLoad->setShortcut(QKeySequence::Open); connect(actionLoad, SIGNAL(triggered()), mw, SLOT(load())); actionReload = new QAction("&Reload", mw); actionReload->setIcon(QIcon(":icons/view-refresh.png")); actionReload->setShortcut(QKeySequence::Refresh); actionReload->setEnabled(false); connect(actionReload, SIGNAL(triggered()), mw, SLOT(reload())); actionPrint = new QAction("&Print", mw); actionPrint->setIcon(QIcon(":icons/document-print.png")); actionPrint->setShortcut(QKeySequence::Print); actionPrint->setEnabled(false); connect(actionPrint, SIGNAL(triggered()), mw, SLOT(print())); actionQuit = new QAction("&Quit", mw); #if QT_VERSION >= 0x040600 actionQuit->setShortcut(QKeySequence::Quit); #else actionQuit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); #endif connect(actionQuit, SIGNAL(triggered()), mw, SLOT(close())); // // "Plot"-menu // actionZoomFit = new QAction("Fit to Window", mw); actionZoomFit->setIcon(QIcon(":icons/zoom-fit-best.png")); actionZoomFit->setEnabled(false); connect(actionZoomFit, SIGNAL(triggered()), mw, SLOT(zoomFit())); actionZoom = new QAction("&Zoom", mw); actionZoom->setIcon(QIcon(":icons/page-zoom.png")); actionZoom->setCheckable(true); actionZoom->setEnabled(false); connect(actionZoom, SIGNAL(toggled(bool)), mw, SLOT(setZoomEnabled(bool))); actionMove = new QAction("&Move", mw); actionMove->setIcon(QIcon(":icons/input-mouse.png")); actionMove->setCheckable(true); actionMove->setChecked(false); actionMove->setEnabled(false); connect(actionMove, SIGNAL(toggled(bool)), mw, SLOT(setMoveEnabled(bool))); actionZoom->setChecked(true); // // "Go"-menu // actionGoFirst = new QAction("&First", mw); actionGoFirst->setShortcut(QKeySequence::MoveToStartOfLine); actionGoFirst->setEnabled(false); connect(actionGoFirst, SIGNAL(triggered()), mw, SLOT(goFirst())); actionGoPrevious = new QAction("&Previous", mw); actionGoPrevious->setShortcut(QKeySequence::MoveToPreviousPage); actionGoPrevious->setIcon(mw->style()->standardIcon(QStyle::SP_MediaSkipBackward)); actionGoPrevious->setEnabled(false); connect(actionGoPrevious, SIGNAL(triggered()), mw, SLOT(goPrevious())); actionGoNext = new QAction("&Next", mw); actionGoNext->setShortcut(QKeySequence::MoveToNextPage); actionGoNext->setIcon(mw->style()->standardIcon(QStyle::SP_MediaSkipForward)); actionGoNext->setEnabled(false); connect(actionGoNext, SIGNAL(triggered()), mw, SLOT(goNext())); actionGoLast = new QAction("&Last", mw); actionGoLast->setShortcut(QKeySequence::MoveToEndOfLine); actionGoLast->setEnabled(false); connect(actionGoLast, SIGNAL(triggered()), mw, SLOT(goLast())); actionWatchLatest = new QAction("&Watch Latest", mw); actionWatchLatest->setCheckable(true); actionWatchLatest->setChecked(false); actionWatchLatest->setEnabled(false); connect(actionWatchLatest, SIGNAL(toggled(bool)), mw, SLOT(setWatchLatest(bool))); // // "Tools"-menu // actionMaskNew = new QAction("&New", mw); actionMaskNew->setEnabled(false); connect(actionMaskNew, SIGNAL(triggered()), mw, SLOT(newMask())); actionMaskLoad = new QAction("&Open", mw); actionMaskLoad->setEnabled(false); connect(actionMaskLoad, SIGNAL(triggered()), mw, SLOT(loadMask())); actionMaskSaveAs = new QAction("&Save As ...", mw); actionMaskSaveAs->setEnabled(false); connect(actionMaskSaveAs, SIGNAL(triggered()), mw, SLOT(saveMaskAs())); actionMaskByThreshold = new QAction("By Threshold ...", mw); actionMaskByThreshold->setEnabled(false); connect(actionMaskByThreshold, SIGNAL(triggered()), mw, SLOT(setMaskByThreshold())); actionMaskAddPoint = new QAction("Add pixel", mw); actionMaskAddPoint->setCheckable(true); actionMaskAddPoint->setChecked(false); actionMaskAddPoint->setEnabled(false); connect(actionMaskAddPoint, SIGNAL(toggled(bool)), mw, SLOT(setMaskAddPointsEnabled(bool))); actionMaskAddPolygon = new QAction("Add polygon", mw); actionMaskAddPolygon->setCheckable(true); actionMaskAddPolygon->setChecked(false); actionMaskAddPolygon->setEnabled(false); connect(actionMaskAddPolygon, SIGNAL(toggled(bool)), mw, SLOT(setMaskAddPolygonEnabled(bool))); actionMaskRemovePoint = new QAction("Remove pixel", mw); actionMaskRemovePoint->setCheckable(true); actionMaskRemovePoint->setChecked(false); actionMaskRemovePoint->setEnabled(false); connect(actionMaskRemovePoint, SIGNAL(toggled(bool)), mw, SLOT(setMaskRemovePointsEnabled(bool))); actionMaskRemovePolygon = new QAction("Remove polygon", mw); actionMaskRemovePolygon->setCheckable(true); actionMaskRemovePolygon->setChecked(false); actionMaskRemovePolygon->setEnabled(false); connect(actionMaskRemovePolygon, SIGNAL(toggled(bool)), mw, SLOT(setMaskRemovePolygonEnabled(bool))); // // "Window"-menu // actionPreviousPlot = new QAction("&Previous Image", mw); actionPreviousPlot->setShortcut(QKeySequence::PreviousChild); connect(actionPreviousPlot, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); actionNextPlot = new QAction("&Next Image", mw); actionNextPlot->setShortcut(QKeySequence::NextChild); connect(actionNextPlot, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); actionCascadePlots = new QAction("C&ascade Images", mw); connect(actionCascadePlots, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); actionTilePlots = new QAction("&Tile Images", mw); connect(actionTilePlots, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); actionClosePlot = new QAction("&Close Current Image", mw); actionClosePlot->setShortcut(QKeySequence::Close); connect(actionClosePlot, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); actionCloseAllPlots = new QAction("Close &All Images", mw); connect(actionCloseAllPlots, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); // // "Help"-menu // actionAbout = new QAction("&About", mw); connect(actionAbout, SIGNAL(triggered()), mw, SLOT(about())); actionGroupPlotPicker = new QActionGroup(mw); actionGroupPlotPicker->addAction(actionZoom); actionGroupPlotPicker->addAction(actionMove); actionGroupPlotPicker->addAction(actionMaskAddPoint); actionGroupPlotPicker->addAction(actionMaskAddPolygon); actionGroupPlotPicker->addAction(actionMaskRemovePoint); actionGroupPlotPicker->addAction(actionMaskRemovePolygon); }
void MainWindow::createActions() { newAction = new QAction(tr("&New"), this); newAction->setIcon(QIcon(":/images/new.png")); newAction->setShortcut(QKeySequence::New); newAction->setStatusTip(tr("Create a new file")); connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); openAction = new QAction(tr("&Open..."), this); openAction->setIcon(QIcon(":/images/open.png")); openAction->setShortcut(QKeySequence::Open); openAction->setStatusTip(tr("Open an existing file")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); saveAction = new QAction(tr("&Save"), this); saveAction->setIcon(QIcon(":/images/save.png")); saveAction->setShortcut(QKeySequence::Save); saveAction->setStatusTip(tr("Save the file to disk")); connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); saveAsAction = new QAction(tr("Save &As..."), this); saveAsAction->setStatusTip(tr("Save the file under a new name")); connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs())); exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("Exit the application")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); cutAction = new QAction(tr("Cu&t"), this); cutAction->setIcon(QIcon(":/images/cut.png")); cutAction->setShortcut(QKeySequence::Cut); cutAction->setStatusTip(tr("Cut the current selection to the " "clipboard")); connect(cutAction, SIGNAL(triggered()), this, SLOT(cut())); copyAction = new QAction(tr("&Copy"), this); copyAction->setIcon(QIcon(":/images/copy.png")); copyAction->setShortcut(QKeySequence::Copy); copyAction->setStatusTip(tr("Copy the current selection to the " "clipboard")); connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); pasteAction = new QAction(tr("&Paste"), this); pasteAction->setIcon(QIcon(":/images/paste.png")); pasteAction->setShortcut(QKeySequence::Paste); pasteAction->setStatusTip(tr("Paste the clipboard's contents at " "the cursor position")); connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); closeAction = new QAction(tr("Cl&ose"), this); closeAction->setShortcut(QKeySequence::Close); closeAction->setStatusTip(tr("Close the active window")); connect(closeAction, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); closeAllAction = new QAction(tr("Close &All"), this); closeAllAction->setStatusTip(tr("Close all the windows")); connect(closeAllAction, SIGNAL(triggered()), this, SLOT(close())); tileAction = new QAction(tr("&Tile"), this); tileAction->setStatusTip(tr("Tile the windows")); connect(tileAction, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); cascadeAction = new QAction(tr("&Cascade"), this); cascadeAction->setStatusTip(tr("Cascade the windows")); connect(cascadeAction, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); nextAction = new QAction(tr("Ne&xt"), this); nextAction->setShortcut(QKeySequence::NextChild); nextAction->setStatusTip(tr("Move the focus to the next window")); connect(nextAction, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); previousAction = new QAction(tr("Pre&vious"), this); previousAction->setShortcut(QKeySequence::PreviousChild); previousAction->setStatusTip(tr("Move the focus to the previous " "window")); connect(previousAction, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); separatorAction = new QAction(this); separatorAction->setSeparator(true); aboutAction = new QAction(tr("&About"), this); aboutAction->setStatusTip(tr("Show the application's About box")); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show the Qt library's About box")); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); windowActionGroup = new QActionGroup(this); }
void CLogisticMainWindow::setupMenu(const bool &visible) { if (!visible) return; // Document QMenu *documentMenu = menuBar()->addMenu(tr("&Документ")); documentMenu->addAction(tr("Новый"), this, SLOT(slotNewDocument()), QKeySequence(Qt::Key_F3)); documentMenu->addAction(tr("Открыть"), this, SLOT(slotOpenDocument()), QKeySequence(Qt::Key_F4)); documentMenu->addSeparator(); documentMenu->addAction(tr("Печать"), this, SLOT(slotPrintDocument())); documentMenu->addSeparator(); documentMenu->addAction(tr("Переместить"), this, SLOT(slotCutDocument()), QKeySequence(Qt::Key_F6)); documentMenu->addAction(tr("Копировать"), this, SLOT(slotCopyDocument())); documentMenu->addAction(tr("Вставить"),this, SLOT(slotPasteDocument())); documentMenu->addAction(tr("Удалить"), this, SLOT(slotDeleteDocument()), QKeySequence(Qt::Key_F8)); documentMenu->addSeparator(); documentMenu->addAction(tr("Найти..."), this, SLOT(slotSearchDocument())); documentMenu->addAction(tr("Найти следующий"), this, SLOT(slotSearchNextDocument())); documentMenu->addAction(tr("Найти предыдущий"), this, SLOT(slotSearchPrevDocument())); documentMenu->addSeparator(); documentMenu->addAction(tr("Обновить"), this, SLOT(slotRefreshDocument())); documentMenu->addAction(tr("Стать владельцем"), this, SLOT(slotOwnerDocument())); documentMenu->addSeparator(); documentMenu->addAction(tr("Выход"), this, SLOT(close()), QKeySequence(Qt::ALT | Qt::Key_F4)); // Folder QMenu *folderMenu = menuBar()->addMenu(tr("&Папка")); folderMenu->addAction(tr("Взаимоотношения"), this, SLOT(slotRelationsFolder())); folderMenu->addAction(tr("Календать"), this, SLOT(slotCalendarFolder())); folderMenu->addAction(tr("Напоминания"), this, SLOT(slotReminderFolder())); // Dictionary QMenu *dictionaryMenu = menuBar()->addMenu(tr("Справочники")); dictionaryMenu->addAction(tr("Заказчики"), this, SLOT(slotCustomerDictionary())); dictionaryMenu->addAction(tr("Поставщики"), this, SLOT(slotSuppliersDictionary())); dictionaryMenu->addAction(tr("Производители"), this, SLOT(slotProdusersDictionary())); dictionaryMenu->addSeparator(); dictionaryMenu->addAction(tr("Контакты"), this, SLOT(slotContactsDictionary())); dictionaryMenu->addAction(tr("Должности"), this, SLOT(slotPositionsDictionary())); dictionaryMenu->addSeparator(); dictionaryMenu->addAction(tr("Типы задач"), this, SLOT(slotTaskTypesDictionary())); dictionaryMenu->addAction(tr("Типы контрагентов"), this, SLOT(slotContractorTypesDictionary())); dictionaryMenu->addAction(tr("Статусы"), this, SLOT(slotStatusDictionary())); dictionaryMenu->addAction(tr("Приоритеты"), this, SLOT(slotPrioritiesDictionary())); dictionaryMenu->addSeparator(); dictionaryMenu->addAction(tr("Страны и города"), this, SLOT(slotCountryCityDictionary())); // View QMenu *viewMenu = menuBar()->addMenu(tr("&Вид")); QAction *m_actual = viewMenu->addAction(tr("Актуальные документы")); connect(m_actual, SIGNAL(triggered()), SLOT(slotActualDocumentsView())); viewMenu->addAction(tr("Дерево документов"), this, SLOT(slotTreeDocumentsView()), QKeySequence(Qt::Key_F9)); // Window QMenu *windowMenu = menuBar()->addMenu(tr("&Окно")); QAction *close = windowMenu->addAction(tr("Закрыть")); connect(close, SIGNAL(triggered()), mdiArea, SLOT(closeActiveSubWindow())); QAction *closeAll = windowMenu->addAction(tr("Закрыть все")); connect(closeAll, SIGNAL(triggered()), mdiArea, SLOT(closeAllSubWindows())); windowMenu->addSeparator(); QAction *m_tile = windowMenu->addAction(tr("Плитка")); connect(m_tile, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); QAction *m_cascade = windowMenu->addAction(tr("Каскад")); connect(m_cascade, SIGNAL(triggered()), mdiArea, SLOT(cascadeSubWindows())); windowMenu->addSeparator(); QMenu *modeMenu = windowMenu->addMenu(tr("Режим отображения")); QAction *m_modeMdi = modeMenu->addAction(tr("Оконный")); connect(m_modeMdi, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); QAction *m_modeWindow = modeMenu->addAction(tr("Вкладки")); connect(m_modeWindow, SIGNAL(triggered()), mdiArea, SLOT(tileSubWindows())); windowMenu->addSeparator(); QAction *next = windowMenu->addAction(tr("Следующее")); connect(next, SIGNAL(triggered()), mdiArea, SLOT(activateNextSubWindow())); QAction *previous = windowMenu->addAction(tr("Предыдущее")); connect(previous, SIGNAL(triggered()), mdiArea, SLOT(activatePreviousSubWindow())); }