/** * Activates all action buttons. */ void FotoLab::activateActions() { connect(ui.actionClose, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(openImage())); connect(ui.actionReload, SIGNAL(triggered()), this, SLOT(reloadImageData())); connect(ui.actionSaveAs, SIGNAL(triggered()), this, SLOT(saveImage())); connect(ui.actionAreaColor, SIGNAL(triggered()), this, SLOT(showColorDialog())); connect(ui.actionFillArea, SIGNAL(triggered()), ui.graphicsView, SLOT(fillArea())); connect(ui.actionCut, SIGNAL(triggered()), this, SLOT(cutArea())); connect(ui.actionEdges, SIGNAL(triggered()), this, SLOT(proposeEdges())); connect(ui.actionLines, SIGNAL(triggered()), this, SLOT(proposeLines())); connect(ui.actionDrawArea, SIGNAL(triggered()), ui.graphicsView, SLOT(switchDrawing())); // connect(ui.actionProcess, SIGNAL(triggered()), ui.graphicsView, SLOT(processErase())); connect(ui.actionProcess, SIGNAL(triggered()), ui.graphicsView, SLOT(processShowEdges())); connect(ui.actionProperties, SIGNAL(triggered()), this, SLOT(showProperties())); connect(ui.actionHelpAbout, SIGNAL(triggered()), this, SLOT(showHelpAbout())); // processShowEdges connect(ui.actionZoomIn, SIGNAL(triggered()), ui.graphicsView, SLOT(zoomIn())); connect(ui.actionZoomOut, SIGNAL(triggered()), ui.graphicsView, SLOT(zoomOut())); connect(ui.actionZoomNormal, SIGNAL(triggered()), ui.graphicsView, SLOT(zoomNormal())); connect(ui.actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(&tlowSpin, SIGNAL(valueChanged(double)), this, SLOT(validateLowTreshold(double))); connect(&thighSpin, SIGNAL(valueChanged(double)), this, SLOT(validateHighTreshold(double))); }
void ImageView::loadImageData(const QString& source) { imageSource = source; image = new QImage(imageSource); imageitem = new ImageItem(*image); imageitem->setPos(0, 0); edgepath = new QGraphicsPathItem(imageitem); edgepath->setPen(QPen(PolygonItem::defaultAreaColor, 4, Qt::SolidLine, Qt::FlatCap, Qt::BevelJoin)); area = new PolygonItem(imageitem->rect(), edgepath); scene = new QGraphicsScene(this); setBackgroundBrush(QBrush(Qt::gray, Qt::DiagCrossPattern)); scene->setSceneRect(imageitem->rect()); setScene(scene); scene->addItem(imageitem); scene->addItem(edgepath); edgepath->setPos(0, 0); scene->addItem(area); // QGraphicsLineItem* lnitem = new QGraphicsLineItem(area); // lnitem->setPos(image->width() / 2, image->height() / 2 ); // lnitem->setLine(0, 0, image->width(), 0); // //lnitem->setPos() // lnitem->setPen(QPen(Qt::blue)); // lnitem->rotate(45); // // scene->addItem(lnitem); zoomNormal(); }
void MainWindow::createActions() { printAct = new QAction(QIcon(":/images/print.png"), tr("&Print..."), this); // printAct->setShortcut(QKeySequence::Print); printAct->setStatusTip(tr("Print the document")); connect(printAct, SIGNAL(triggered()), this, SLOT(printFile())); // Added by AiO to Open a new file openAct = new QAction(tr("&Open"), this); openAct->setShortcut(Qt::Key_O | Qt::CTRL); openAct->setStatusTip(tr("Open a new file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("Save &As..."), this); // saveAsAct->setShortcut(QKeySequence::SaveAs); saveAsAct->setStatusTip(tr("Save the document under a new name")); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(Qt::Key_Escape); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); normalAct = new QAction(QIcon(":/images/normalView.png"), tr("Normal view"), this); normalAct->setCheckable(true); normalAct->setChecked(true); normalAct->setShortcut(Qt::Key_N); normalAct->setStatusTip(tr("Normal view")); connect(normalAct, SIGNAL(triggered()), this, SLOT(normal())); polarAct = new QAction(QIcon(":/images/polar.png"), tr("Polar fish eye"), this); polarAct->setCheckable(true); polarAct->setShortcut(Qt::Key_P | Qt::CTRL); polarAct->setStatusTip(tr("Polar fish eye")); connect(polarAct, SIGNAL(triggered()), this, SLOT(polar())); polarFixedAct = new QAction(QIcon(":/images/fixedPolar.png"), tr("Fixed radius polar fish eye"), this); polarFixedAct->setCheckable(true); polarFixedAct->setShortcut(Qt::Key_P); polarFixedAct->setStatusTip(tr("Fixed radius polar fish eye")); connect(polarFixedAct, SIGNAL(triggered()), this, SLOT(polarFixed())); cartAct = new QAction(QIcon(":/images/cartesian.png"), tr("Cartesian fish eye"), this); cartAct->setCheckable(true); cartAct->setShortcut(Qt::Key_C | Qt::CTRL); cartAct->setStatusTip(tr("Cartesian fish eye")); connect(cartAct, SIGNAL(triggered()), this, SLOT(cart())); cartFixedAct = new QAction(QIcon(":/images/fixedCartesian.png"), tr("Fixed radius cartesian fish eye"), this); cartFixedAct->setCheckable(true); cartFixedAct->setShortcut(Qt::Key_C); cartFixedAct->setStatusTip(tr("Fixed radius cartesian fish eye")); connect(cartFixedAct, SIGNAL(triggered()), this, SLOT(cartFixed())); showLabelsAct = new QAction(QIcon(":/images/labelEdges.png"), tr("Display edge labels"), this); showLabelsAct->setCheckable(true); showLabelsAct->setStatusTip(tr("Display edge labels")); connect(showLabelsAct, SIGNAL(triggered()), this, SLOT(showLabels())); // connect(showLabelsAct, SIGNAL(toggled(bool)), this, SLOT(toggleShowLabels(bool))); zoomInAct = new QAction(QIcon(":/images/zoomIn.png"), tr("Zoom in"), this); zoomInAct->setShortcut(Qt::Key_Plus); zoomInAct->setStatusTip(tr("Zoom in")); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(QIcon(":/images/zoomOut.png"), tr("Zoom out"), this); zoomOutAct->setShortcut(Qt::Key_Minus); zoomOutAct->setStatusTip(tr("Zoom out")); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); zoomNormalAct = new QAction(QIcon(":/images/zoomNormal.png"), tr("Zoom normal"), this); zoomNormalAct->setShortcut(Qt::Key_0); zoomNormalAct->setStatusTip(tr("Zoom normal (100%)")); connect(zoomNormalAct, SIGNAL(triggered()), this, SLOT(zoomNormal())); fitAllAct = new QAction(QIcon(":/images/fitAll.png"), tr("Fit all graph"), this); fitAllAct->setShortcut(Qt::Key_M); fitAllAct->setStatusTip(tr("Fit all graph")); connect(fitAllAct, SIGNAL(triggered()), this, SLOT(fitAll())); positOriginAct = new QAction(QIcon(":/images/positOrigin.png"), tr("Position on origin"), this); positOriginAct->setShortcut(Qt::Key_O); positOriginAct->setStatusTip(tr("Position on origin")); connect(positOriginAct, SIGNAL(triggered()), this, SLOT(positOrigin())); easyPanAct = new QAction(tr("Easy graph panning"), this); easyPanAct->setCheckable(true); easyPanAct->setStatusTip(tr("Easy graph panning")); connect(easyPanAct, SIGNAL(triggered()), this, SLOT(easyPan())); helpAct = new QAction(tr("Help"), this); helpAct->setShortcut(Qt::Key_F1); helpAct->setStatusTip(tr("Display help")); connect(helpAct, SIGNAL(triggered()), this /*qApp*/, SLOT(help())); aboutAct = new QAction(tr("&About..."), this); aboutAct->setStatusTip(tr("Show the About box")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); //Added by AiO new action for search window searchAct = new QAction(tr("&Search"), this); searchAct->setShortcut(Qt::Key_F5); searchAct->setStatusTip(tr("Search F5")); connect(searchAct, SIGNAL(triggered()), this, SLOT(showSearch())); }