/** * Defines mouse button release event. */ void Photo_Viewer::mouseReleaseEvent(QMouseEvent *pEvent) { //if left mouse button pressed if (pEvent->button() == Qt::LeftButton) { int sizeX = pEvent->x(); //previous button pressed if (sizeX<=222) { previousImage(); } //next button pressed if (sizeX>=666) { nextImage(); } //middle section pressed if (sizeX>222 && sizeX<666) { //invert slideshow toggle if (getSlideshowToggle()==0) { setSlideshowToggle(1); } else { setSlideshowToggle(0); } if (getSlideshowToggle()==1) { startSlideshow(); } } } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); currentStep1 = 0; currentStep2 = 0; imageSteps1 << 0; imageSteps2 << 0; // fp = 0; rubberBand1 = new QRubberBand(QRubberBand::Rectangle, ui->imageDisplay); rubberBand2 = new QRubberBand(QRubberBand::Rectangle, ui->imageDisplay_2); connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(load())); connect(ui->analyzeButton, SIGNAL(clicked()), this, SLOT(processImage())); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextImage())); connect(ui->previousButton, SIGNAL(clicked()), this, SLOT(previousImage())); connect(ui->fitnessButton, SIGNAL(clicked()), this, SLOT(showPlot())); connect(ui->leftRadioButton, SIGNAL(clicked()), this, SLOT(selectImageLabel())); connect(ui->rightRadioButton, SIGNAL(clicked()), this, SLOT(selectImageLabel())); connect(ui->deleteStepButton, SIGNAL(clicked()), this, SLOT(removeStep())); connect(ui->compareButton, SIGNAL(clicked()), this, SLOT(compareSides())); ui->imageDisplay->setMouseTracking(true); ui->imageDisplay_2->setMouseTracking(true); ui->imageDisplay->installEventFilter(this); ui->imageDisplay_2->installEventFilter(this); ui->fitnessButton->setEnabled(false); selectImageLabel(); }
void MainWindow::removeStep() { if(currentImageSteps->size() == 1) return; previousImage(); delete currentImageSteps->at(*currentStep+1); currentImageSteps->removeAt(*currentStep+1); updatePageNumbers(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), theCurImageIndex(0), theProcessingInProgressFlag(false) { ui->setupUi(this); theDragModeStrings.insert(QGraphicsView::NoDrag, "No Drag Mode"); theDragModeStrings.insert(QGraphicsView::RubberBandDrag, "Selection Mode"); theDragModeStrings.insert(QGraphicsView::ScrollHandDrag, "Scroll Mode"); connect(ui->thePic, SIGNAL(scrollModeChanged(QGraphicsView::DragMode)), this, SLOT(updateStatusBar(QGraphicsView::DragMode))); connect(ui->thePic, SIGNAL(rectangleSelected(QPoint,QPoint)), this, SLOT(rectangleSelection(QPoint,QPoint))); // List manipulation button handlers connect(ui->theUpButton, SIGNAL(clicked()), this, SLOT(movePageSelectionUp())); connect(ui->theDownButton, SIGNAL(clicked()), this, SLOT(movePageSelectionDown())); connect(ui->theDeleteButton, SIGNAL(clicked()), this, SLOT(deletePageSelection())); // Want to know when the Process Images button should be enabled. The rectangleSelection and deletePageSelection // button are the two buttons that effect the number of items in the list connect(ui->thePic, SIGNAL(rectangleSelected(QPoint,QPoint)), this, SLOT(isImageProcessingAllowed())); connect(ui->theDeleteButton, SIGNAL(clicked()), this, SLOT(isImageProcessingAllowed())); connect(ui->theNextImageButton, SIGNAL(clicked()), this, SLOT(nextImage())); connect(ui->thePreviousImageButton, SIGNAL(clicked()), this, SLOT(previousImage())); connect(ui->theProcessImagesButton, SIGNAL(clicked()), this, SLOT(processImages())); connect(ui->theWritePdfButton, SIGNAL(clicked()), this, SLOT(writePdf())); // Connect menu buttons connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAboutDialog())); connect(ui->actionAbout_Qt, SIGNAL(triggered()), this, SLOT(showAboutQtDialog())); connect(ui->actionStart_Server, SIGNAL(triggered()), this, SLOT(startServerDialog())); connect(ui->actionOpen_Directory, SIGNAL(triggered()), this, SLOT(openDirectoryChooser())); updateStatusBar(ui->thePic->dragMode()); }
void Slideshow::mouseReleaseEvent (QMouseEvent* event) { if (event->button() & (Qt::LeftButton | Qt::RightButton)) { if (!dragging) { if (event->button() == Qt::LeftButton) nextImage (); else previousImage (); } } else if (event->button() == Qt::MidButton) { QString dirname = QFileDialog::getExistingDirectory (this, tr("Open Directory"), currentDir.absolutePath()); if (dirname.count() > 0) setDirectory (dirname); } dragging = false; }
void Slideshow::keyPressEvent (QKeyEvent* event) { int key = event->key(); if (key == Qt::Key_S || key == Qt::Key_Space) { toggleSlideshow (); } else if (key == Qt::Key_Left) { previousImage (); } else if (key == Qt::Key_Right) { nextImage (); } else if (key == Qt::Key_Q) { exit (0); } else if (key == Qt::Key_F || key == Qt::Key_F11) { if (fullscreen) showNormal(); else showFullScreen(); fullscreen = !fullscreen; } }
ImageView::ImageView(QWidget *parent) : QMainWindow(parent), ui(new Ui::ImageView) { ui->setupUi(this); setWindowTitle("MicroLab ImgP"); //! \brief connectActionToSlots //! connectActionToSlots(); newSonWidgets(); connect(ui->openDirAction, SIGNAL(triggered()), this, SLOT(openDir())); connect(ui->openFileAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save())); connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveAs())); connect(ui->actionExit_4, SIGNAL(triggered()), this, SLOT(close())); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextImage())); connect(ui->previousButton, SIGNAL(clicked()), this, SLOT(previousImage())); connect(ui->beginButton, SIGNAL(clicked()), this, SLOT(setBegin())); connect(ui->endButton, SIGNAL(clicked()), this, SLOT(setEnd())); connect(ui->slideShowButton, SIGNAL(clicked()), this, SLOT(slideShow())); connect(ui->slideShowDelaySlider, SIGNAL(valueChanged(int)), this, SLOT(setSlideShowDelay(int))); slideshowTimer = new QTimer(this); connect(slideshowTimer, SIGNAL(timeout()), this, SLOT(nextImage())); ui->imageNameLabel->setText(tr("Select a folder from the <b>file -> openDir</b> or <b>file->openFile</b> menu to view images or image..")); ui->openFileAction->setShortcut(tr("Ctrl+O")); setImage(":/images/Cover.jpg"); ui->previousButton->setEnabled(false); ui->nextButton->setEnabled(false); ui->beginButton->setEnabled(false); ui->endButton->setEnabled(false); ui->slideShowButton->setEnabled(false); ui->slideShowDelaySlider->setEnabled(false); ui->slideShowDelayLabel->setEnabled(false); ui->slideShowDelaySlider->setValue(15); //! NOTICE HERE ui->actionOpen_Recent_Files->setEnabled(false); ui->actionSave->setEnabled(false); ui->actionSave_As->setEnabled(true); ui->actionLecel_Set->setEnabled(false); //! @warning Bug setButtonIcon(ui->slideShowButton, ":/images/buttons/play.png", 48, 48); setButtonIcon(ui->nextButton, ":/images/buttons/next.png", 48, 48); setButtonIcon(ui->previousButton, ":/images/buttons/back.png", 48, 48); setButtonIcon(ui->beginButton, ":/images/buttons/rewind.png", 48, 48); setButtonIcon(ui->endButton, ":/images/buttons/fastfwd.png", 48, 48); setWindowTitle(tr("ImageView")); folderName = ""; imageNumber = 0; totalImages = 0; slideShowDelay = 2.0; QLabel *label = new QLabel("<a href = http://yajunyang.cn>connect me...</a>", this); connect(label, SIGNAL(linkActivated(QString)), this, SLOT(openUrl(QString))); ui->statusBar->insertWidget(0, label); }