void QoccHarnessWindow::createActions() { newAction = new QAction(tr("&New"), this); newAction->setShortcut(tr("Ctrl+N")); newAction->setStatusTip(tr("Create a new file")); connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); openAction = new QAction(tr("&Open..."), this); openAction->setShortcut(tr("Ctrl+O")); openAction->setStatusTip(tr("Open an existing file")); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); saveAction = new QAction(tr("&Save"), this); saveAction->setShortcut(tr("Ctrl+S")); saveAction->setStatusTip(tr("Save the document to disk")); connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); printAction = new QAction(tr("&Print..."), this); printAction->setShortcut(tr("Ctrl+P")); printAction->setStatusTip(tr("Print the document")); connect(printAction, SIGNAL(triggered()), this, SLOT(print())); exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(tr("Ctrl+X")); exitAction->setStatusTip(tr("Exit the application")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); undoAction = new QAction(tr("&Undo"), this); undoAction->setShortcut(tr("Ctrl+Z")); undoAction->setStatusTip(tr("Undo the last operation")); connect(undoAction, SIGNAL(triggered()), this, SLOT(undo())); redoAction = new QAction(tr("&Redo"), this); redoAction->setShortcut(tr("Ctrl+Y")); redoAction->setStatusTip(tr("Redo the last operation")); connect(redoAction, SIGNAL(triggered()), this, SLOT(redo())); cutAction = new QAction(tr("Cu&t"), this); cutAction->setShortcut(tr("Ctrl+X")); cutAction->setStatusTip(tr("Cut the current selection's contents to the clipboard")); connect(cutAction, SIGNAL(triggered()), this, SLOT(cut())); copyAction = new QAction(tr("&Copy"), this); copyAction->setShortcut(tr("Ctrl+C")); copyAction->setStatusTip(tr("Copy the current selection's contents to the clipboard")); connect(copyAction, SIGNAL(triggered()), this, SLOT(copy())); pasteAction = new QAction(tr("&Paste"), this); pasteAction->setShortcut(tr("Ctrl+V")); pasteAction->setStatusTip(tr("Paste the clipboard's contents into the current selection")); connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste())); 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())); connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt())); // Now for the QtOCCViewWidget slots. /* fitAction = new QAction(tr("&Fit Window"), this); fitAction->setShortcut(tr("Ctrl+F")); fitAction->setStatusTip(tr("Fit to window")); connect(fitAction, SIGNAL(triggered()), myOCC, SLOT(fitExtents())); */ fitAllAction = new QAction(tr("&Fit All"), this); fitAllAction->setShortcut(tr("Ctrl+F")); fitAllAction->setStatusTip(tr("Fit contents to viewport")); connect(fitAllAction, SIGNAL(triggered()), myOCC, SLOT(fitAll())); zoomAction = new QAction(tr("&Zoom"), this); zoomAction->setStatusTip(tr("Zoom in window")); connect(zoomAction, SIGNAL(triggered()), myOCC, SLOT(fitArea())); panAction = new QAction(tr("&Pan"), this); panAction->setStatusTip(tr("Window panning")); connect(panAction, SIGNAL(triggered()), myOCC, SLOT(pan())); rotAction = new QAction(tr("&Rotate"), this); rotAction->setShortcut(tr("Ctrl+R")); rotAction->setStatusTip(tr("Window rotation")); connect(rotAction, SIGNAL(triggered()), myOCC, SLOT(rotation())); gridToggleAction = new QAction(tr("Toggle &Grid"), this); gridToggleAction->setShortcut(tr("Ctrl+G")); gridToggleAction->setStatusTip(tr("Turn the grid on or off")); connect(gridToggleAction, SIGNAL(triggered()), myVC, SLOT(gridToggle())); /* gridOffAction = new QAction(tr("Gri&d Off"), this); gridOffAction->setShortcut(tr("Ctrl+D")); gridOffAction->setStatusTip(tr("Turn the grid on")); connect(gridOffAction, SIGNAL(triggered()), myVC, SLOT(gridOff())); */ gridXYAction = new QAction(tr("XY Grid"), this); gridXYAction->setStatusTip(tr("Grid on XY Plane")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridXYAction, SIGNAL(triggered()), myVC, SLOT(gridXY())); gridXZAction = new QAction(tr("XZ Grid"), this); gridXZAction->setStatusTip(tr("Grid on XZ Plane")); //gridXZAction->setShortcut(tr("Ctrl+Y")); connect(gridXZAction, SIGNAL(triggered()), myVC, SLOT(gridXZ())); gridYZAction = new QAction(tr("YZ Grid"), this); gridYZAction->setStatusTip(tr("Grid on YZ Plane")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridYZAction, SIGNAL(triggered()), myVC, SLOT(gridYZ())); gridRectAction = new QAction(tr("Rectangular"), this); gridRectAction->setStatusTip(tr("Retangular grid")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridRectAction, SIGNAL(triggered()), myVC, SLOT(gridRect())); gridCircAction = new QAction(tr("Circular"), this); gridCircAction->setStatusTip(tr("Circular grid")); //gridOffAction->setShortcut(tr("Ctrl+Z")); connect(gridCircAction, SIGNAL(triggered()), myVC, SLOT(gridCirc())); // Standard View viewFrontAction = new QAction(tr("Front"), this); viewFrontAction->setStatusTip(tr("View From Front")); connect(viewFrontAction, SIGNAL(triggered()), myOCC, SLOT(viewFront())); viewBackAction = new QAction(tr("Back"), this); viewBackAction->setStatusTip(tr("View From Back")); connect(viewBackAction, SIGNAL(triggered()), myOCC, SLOT(viewBack())); viewTopAction = new QAction(tr("Top"), this); viewTopAction->setStatusTip(tr("View From Top")); connect(viewTopAction, SIGNAL(triggered()), myOCC, SLOT(viewTop())); viewBottomAction = new QAction(tr("Bottom"), this); viewBottomAction->setStatusTip(tr("View From Bottom")); connect(viewBottomAction, SIGNAL(triggered()), myOCC, SLOT(viewBottom())); viewLeftAction = new QAction(tr("Left"), this); viewLeftAction->setStatusTip(tr("View From Left")); connect(viewLeftAction, SIGNAL(triggered()), myOCC, SLOT(viewLeft())); viewRightAction = new QAction(tr("Right"), this); viewRightAction->setStatusTip(tr("View From Right")); connect(viewRightAction, SIGNAL(triggered()), myOCC, SLOT(viewRight())); viewAxoAction = new QAction(tr("&Axonometric Fit"), this); viewAxoAction->setStatusTip(tr("Axonometric view and fit all")); viewAxoAction->setShortcut(tr("Ctrl+A")); connect(viewAxoAction, SIGNAL(triggered()), myOCC, SLOT(viewAxo())); viewGridAction = new QAction(tr("Grid"), this); viewGridAction->setStatusTip(tr("View from grid")); connect(viewGridAction, SIGNAL(triggered()), myOCC, SLOT(viewGrid())); viewResetAction = new QAction(tr("Reset"), this); viewResetAction->setStatusTip(tr("Reset the view")); connect(viewResetAction, SIGNAL(triggered()), myOCC, SLOT(viewReset())); backgroundAction = new QAction( tr("&Background"), this ); backgroundAction->setStatusTip(tr("Change the background colour")); connect(backgroundAction, SIGNAL(triggered()), myOCC, SLOT(background())); // The co-ordinates from the view connect( myOCC, SIGNAL(mouseMoved(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT(xyzPosition(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); // Add a point from the view connect( myOCC, SIGNAL(pointClicked(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT (addPoint (V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); connect( myOCC, SIGNAL(sendStatus(const QString)), this, SLOT (statusMessage(const QString)) ); // And the bottle example bottleAction = new QAction(tr("Load &Bottle"), this); bottleAction->setShortcut(tr("Ctrl+B")); bottleAction->setStatusTip(tr("Bottle sample.")); connect(bottleAction, SIGNAL(triggered()), this, SLOT(bottle())); }
void TIGLViewerWindow::connectSignals() { connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); connect(openScriptAction, SIGNAL(triggered()), this, SLOT(openScript())); connect(closeAction, SIGNAL(triggered()), this, SLOT(closeConfiguration())); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); connect(saveScreenshotAction, SIGNAL(triggered()), this, SLOT(makeScreenShot())); connect(setBackgroundAction, SIGNAL(triggered()), this, SLOT(setBackgroundImage())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt())); // Misc drawing actions connect(drawPointAction, SIGNAL(triggered()), this, SLOT(drawPoint())); connect(drawVectorAction, SIGNAL(triggered()), this, SLOT(drawVector())); // view->actions menu connect(fitAction, SIGNAL(triggered()), myOCC, SLOT(fitExtents())); connect(fitAllAction, SIGNAL(triggered()), myOCC, SLOT(fitAll())); //connect(zoomAction, SIGNAL(triggered()), myOCC, SLOT(fitArea())); connect(zoomAction, SIGNAL(triggered()),myOCC, SLOT(zoom())); connect(panAction, SIGNAL(triggered()), myOCC, SLOT(pan())); connect(rotAction, SIGNAL(triggered()), myOCC, SLOT(rotation())); connect(selectAction, SIGNAL(triggered()), myOCC, SLOT(selecting())); // view->grid menu connect(gridOnAction, SIGNAL(toggled(bool)), myScene, SLOT(toggleGrid(bool))); connect(gridXYAction, SIGNAL(triggered()), myScene, SLOT(gridXY())); connect(gridXZAction, SIGNAL(triggered()), myScene, SLOT(gridXZ())); connect(gridYZAction, SIGNAL(triggered()), myScene, SLOT(gridYZ())); connect(gridRectAction, SIGNAL(triggered()), myScene, SLOT(gridRect())); connect(gridCircAction, SIGNAL(triggered()), myScene, SLOT(gridCirc())); // Standard View connect(viewFrontAction, SIGNAL(triggered()), myOCC, SLOT(viewFront())); connect(viewBackAction, SIGNAL(triggered()), myOCC, SLOT(viewBack())); connect(viewTopAction, SIGNAL(triggered()), myOCC, SLOT(viewTop())); connect(viewBottomAction, SIGNAL(triggered()), myOCC, SLOT(viewBottom())); connect(viewLeftAction, SIGNAL(triggered()), myOCC, SLOT(viewLeft())); connect(viewRightAction, SIGNAL(triggered()), myOCC, SLOT(viewRight())); connect(viewAxoAction, SIGNAL(triggered()), myOCC, SLOT(viewAxo())); connect(viewGridAction, SIGNAL(triggered()), myOCC, SLOT(viewGrid())); connect(viewResetAction, SIGNAL(triggered()), myOCC, SLOT(viewReset())); connect(viewZoomInAction, SIGNAL(triggered()), myOCC, SLOT(zoomIn())); connect(viewZoomOutAction, SIGNAL(triggered()), myOCC, SLOT(zoomOut())); connect(showConsoleAction, SIGNAL(toggled(bool)), consoleDockWidget, SLOT(setVisible(bool))); connect(consoleDockWidget, SIGNAL(visibilityChanged(bool)), showConsoleAction, SLOT(setChecked(bool))); connect(showWireframeAction, SIGNAL(toggled(bool)), myScene, SLOT(wireFrame(bool))); connect(openTimer, SIGNAL(timeout()), this, SLOT(reopenFile())); // The co-ordinates from the view connect( myOCC, SIGNAL(mouseMoved(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT(xyzPosition(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); // Add a point from the view connect( myOCC, SIGNAL(pointClicked(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT (addPoint (V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); connect( myOCC, SIGNAL(sendStatus(const QString)), this, SLOT (statusMessage(const QString)) ); connect(stdoutStream, SIGNAL(sendString(QString)), console, SLOT(output(QString))); connect(errorStream , SIGNAL(sendString(QString)), console, SLOT(output(QString))); connect(logDirect.get(), SIGNAL(newMessage(QString)), console, SLOT(output(QString))); connect(scriptEngine, SIGNAL(scriptResult(QString)), console, SLOT(output(QString))); connect(scriptEngine, SIGNAL(scriptError(QString)), console, SLOT(outputError(QString))); connect(scriptEngine, SIGNAL(evalDone()), console, SLOT(endCommand())); connect(console, SIGNAL(onChange(QString)), scriptEngine, SLOT(textChanged(QString))); connect(console, SIGNAL(onCommand(QString)), scriptEngine, SLOT(eval(QString))); connect(settingsAction, SIGNAL(triggered()), this, SLOT(changeSettings())); }