void ImageViewer::createActions() { zoomInAct = new QAction(tr("Zoom &In (25%)"), this); zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); }
void MainWindow::fitToWindow() { bool fitToWindow = ui->actionFitToWindow->isChecked(); ui->scrollArea->setWidgetResizable(fitToWindow); ui->scrollArea->setWidgetResizable(false); if (!fitToWindow) { normalSize(); } else { double ssh=sh*scaleFactor; double ssw=sh*scaleFactor; double sch=ui->scrollArea->height(); double scw=ui->scrollArea->width(); double mh=sch/ssh; double mw=scw/ssw; if (mh<mw) { scaleImage(mh); } else { scaleImage(mw); } } updateActions(); }
void ImageViewer::createActions() { openAct = new QAction(tr("&Open..."), this); openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAct = new QAction(tr("&Save..."), this); saveAct->setShortcut(tr("Ctrl+S")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); saveAct->setEnabled(false); exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom &In (25%)"), this); zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); proceedAct = new QAction(tr("Proceed image"), this); proceedAct->setEnabled(false); proceedAct->setShortcut(tr("Ctrl+P")); connect(proceedAct, SIGNAL(triggered()),this, SLOT(proceed())); proceedByStepAct = new QAction(tr("Proceed image by step"), this); proceedByStepAct->setEnabled(false); connect(proceedByStepAct, SIGNAL(triggered()),this, SLOT(proceedByStep())); // Log function imageProcessor = new ImageProcessor(); connect(imageProcessor,SIGNAL(sendLogMessage(QString,int)), this,SLOT(writeLog(QString,int))); connect(imageProcessor,SIGNAL(sendImage(QImage&)), this,SLOT(updateImage(QImage&))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { scaleFactor=1.0; ui->setupUi(this); ////////////////// db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName("project_DB.s3db"); db.open(); ui->label->setBackgroundRole(QPalette::Base); ui->label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); ui->label->setScaledContents(true); ui->scrollArea->setWidget(ui->label); ui->scrollArea->setBackgroundRole(QPalette::Dark); //setCentralWidget(ui->scrollArea); setWindowTitle(tr("Image Viewer")); resize(500, 400); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openfile())); connect(ui->actionAbout_Program, SIGNAL(triggered()), this, SLOT(aboutProg())); connect(ui->actionHelp, SIGNAL(triggered()), this, SLOT(help())); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exitApp())); connect(ui->actionZoomIn, SIGNAL(triggered()), this, SLOT(zoomIn())); connect(ui->actionZoomOut, SIGNAL(triggered()), this, SLOT(zoomOut())); connect(ui->actionNormal_Size, SIGNAL(triggered()), this, SLOT(normalSize())); connect(ui->actionFitToWindow, SIGNAL(triggered()), this, SLOT(fitToWindow())); connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(zoomIn())); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(zoomOut())); connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT(next())); connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(prev())); ui->actionFitToWindow->setEnabled(false); ui->actionFitToWindow->setCheckable(true); ui->actionFitToWindow->setShortcut(tr("Ctrl+F")); ui->actionNormal_Size->setShortcut(tr("Ctrl+S")); ui->actionNormal_Size->setEnabled(false); ui->actionZoomOut->setShortcut(tr("Ctrl+-")); ui->actionZoomOut->setEnabled(false); ui->actionZoomIn->setShortcut(tr("Ctrl++")); ui->actionZoomIn->setEnabled(false); ui->actionExit->setShortcut(tr("Ctrl+Q")); ui->actionOpen->setShortcut(tr("Ctrl+O")); namefilter.append("*.png"); namefilter.append("*.jpg"); }
void Image::setImage(QImage &img) { QPixmap pixmap = QPixmap::fromImage(img); pict->setImage(img); imageLabel->setPixmap(pixmap); scaleFactor = 1.0; normalSize(); resize(img.width(), img.height()); }
void ImageViewer::fitToWindow() { bool fitToWindow = fitToWindowAct->isChecked(); scrollArea->setWidgetResizable(fitToWindow); if (!fitToWindow) { normalSize(); } updateActions(); }
void ImageWidget::fitToWindow() { bool fitToWindow = m_actionFitToWindow->isChecked(); m_scrollArea->setWidgetResizable(fitToWindow); if (!fitToWindow) { normalSize(); } updateActions(); emit displayed(fitToWindow); }
void MainWindow::createActions() { enterRefPointAct = new QAction(tr("Enter Reference Point"), this); enterRefPointAct->setShortcut(tr("Ctrl+P")); connect(enterRefPointAct, SIGNAL(triggered()), this, SLOT(enterRefPoint())); exitAct = new QAction(tr("Exit"), this); exitAct->setShortcut(tr("Esc, Alt+F12")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); normalSizeAct = new QAction(tr("&Normal Size"), this); normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); openAct = new QAction(tr("&Open..."), this); openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveTransfImgAct = new QAction(tr("Save Transformed Image"), this); saveTransfImgAct->setShortcut(tr("Ctrl+S")); saveTransfImgAct->setEnabled(false); connect(saveTransfImgAct, SIGNAL(triggered()), this, SLOT(saveTransfImg())); showMatrixAct = new QAction(tr("Show Matrix"), this); showMatrixAct->setShortcut(tr("Ctrl+M")); connect(showMatrixAct, SIGNAL(triggered()), this, SLOT(showMatrix())); transformAct = new QAction(tr("&Tranform"), this); transformAct->setShortcut(tr("Ctrl+T")); connect(transformAct, SIGNAL(triggered()), this, SLOT(transform())); testMatrixAct = new QAction(tr("Set Test Matrix"), this); testMatrixAct->setShortcut(tr("Ctrl+E")); connect(testMatrixAct, SIGNAL(triggered()), this, SLOT(setTestMatrix())); zoomInAct = new QAction(tr("Zoom &In (25%)"), this); zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); }
void ImageViewer::createActions() { openAct = new QAction(tr("&Open..."), this); openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom &In (25%)"), this); zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); greyScaleAct = new QAction(tr("&Greyscale"), this); greyScaleAct->setEnabled(false); connect(greyScaleAct, SIGNAL(triggered()), this, SLOT(greyScale())); negativeAct = new QAction(tr("&Negative"), this); negativeAct->setEnabled(false); connect(negativeAct, SIGNAL(triggered()), this, SLOT(negative())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
void dimv::createActions() { openLeftAct = new QAction(tr("Open left..."), this); openLeftAct->setShortcut(tr("Ctrl+L")); connect(openLeftAct, SIGNAL(triggered()), this, SLOT(openLeft())); openRightAct = new QAction(tr("Open right..."), this); openRightAct->setShortcut(tr("Ctrl+R")); connect(openRightAct, SIGNAL(triggered()), this, SLOT(openRight())); zoomInAct = new QAction(tr("Zoom in"), this); zoomInAct->setShortcut(Qt::Key_Plus); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom out"), this); zoomOutAct->setShortcut(Qt::Key_Minus); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("Original size"), this); normalSizeAct->setShortcut(tr("Ctrl+0")); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); leftAct = new QAction(this); leftAct->setShortcut(Qt::Key_Left); connect(leftAct, SIGNAL(triggered()), this, SLOT(left())); rightAct = new QAction(this); rightAct->setShortcut(Qt::Key_Right); connect(rightAct, SIGNAL(triggered()), this, SLOT(right())); upAct = new QAction(this); upAct->setShortcut(Qt::Key_Up); connect(upAct, SIGNAL(triggered()), this, SLOT(up())); downAct = new QAction(this); downAct->setShortcut(Qt::Key_Down); connect(downAct, SIGNAL(triggered()), this, SLOT(down())); exitAct = new QAction(tr("Close"), this); exitAct->setShortcut(Qt::Key_Escape); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); }
ImageWidget::ImageWidget(QWidget *parent) : QWidget(parent) { setMinimumSize(300, 300); m_layout = new QVBoxLayout(this); this->setLayout(m_layout); m_imageLabel = new QLabel(this); m_imageLabel->setBackgroundRole(QPalette::Base); m_imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); m_imageLabel->setScaledContents(true); m_imageLabel->hide(); m_scrollArea = new QScrollArea(this); m_scrollArea->setBackgroundRole(QPalette::Dark); m_scrollArea->setWidget(m_imageLabel); m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); m_layout->addWidget(m_scrollArea); this->m_actionFitToWindow = new QAction(tr("Fit To Window"), this); m_actionFitToWindow->setEnabled(false); m_actionFitToWindow->setCheckable(true); this->m_actionNormalSize = new QAction(tr("Normal Size"),this); m_actionNormalSize->setEnabled(false); this->m_actionZoomIn = new QAction(tr("Zoom In"), this); m_actionZoomIn->setEnabled(false); this->m_actionZoomOut = new QAction(tr("Zoom Out"), this); m_actionZoomOut->setEnabled(false); this->m_contextMenu = new QMenu(this); m_contextMenu->addAction(m_actionZoomIn); m_contextMenu->addAction(m_actionZoomOut); m_contextMenu->addAction(m_actionNormalSize); m_contextMenu->addSeparator(); m_contextMenu->addAction(m_actionFitToWindow); this->setContextMenuPolicy(Qt::DefaultContextMenu); connect(m_actionFitToWindow, SIGNAL(triggered()), this, SLOT(fitToWindow())); connect(m_actionNormalSize, SIGNAL(triggered()), this, SLOT(normalSize())); connect(m_actionZoomIn, SIGNAL(triggered()), this, SLOT(zoomIn())); connect(m_actionZoomOut, SIGNAL(triggered()), this, SLOT(zoomOut())); }
void ImageViewer::createActions() { printAct = new QAction(tr("&Print..."), this); printAct->setShortcut(tr("Ctrl+P")); printAct->setEnabled(false); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom &In (25%)"), this); zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
void MainWindow::createActions() { openAct = new QAction(tr("&Open"), this); openAct->setToolTip(tr("Open an image")); actionsManager->addAction(openAct, "_open", this, this, SLOT(open()), QKeySequence::Open); saveAct = new QAction(tr("&Save"), this); saveAct->setEnabled(false); actionsManager->addAction(saveAct, "_save", this, this, SLOT(save()), QKeySequence::Save); exitAct = new QAction(tr("&Exit"), this); actionsManager->addAction(exitAct, "_exit", this, this, SLOT(close()), QKeySequence::Quit); filePropertiesAct = new QAction(tr("Properties"), this); filePropertiesAct->setEnabled(false); actionsManager->addAction(filePropertiesAct, "_fileProperties", this, this, SLOT(fileProperties()), QKeySequence("Ctrl+.")); zoomInAct = new QAction(tr("Zoom In"), this); zoomInAct->setEnabled(false); actionsManager->addAction(zoomInAct, "_zoomIn", this, this, SLOT(zoomIn()), QKeySequence("+")); zoomOutAct = new QAction(tr("Zoom Out"), this); zoomOutAct->setEnabled(false); actionsManager->addAction(zoomOutAct, "_zoomOut", this, this, SLOT(zoomOut()), QKeySequence("-")); normalSizeAct = new QAction(tr("Normal Size"), this); normalSizeAct->setEnabled(false); actionsManager->addAction(normalSizeAct, "_normalSize", this, this, SLOT(normalSize()), QKeySequence("1")); adjustSizeAct = new QAction(tr("Best Fit"), this); adjustSizeAct->setEnabled(false); adjustSizeAct->setCheckable(true); actionsManager->addAction(adjustSizeAct, "_adjustSize", this, this, SLOT(adjustSizeSlot()), QKeySequence("0")); rotateRightAct = new QAction(tr("Rotate to right"), this); rotateRightAct->setToolTip(tr("Rotate image in the clockwise clock")); rotateRightAct->setEnabled(false); actionsManager->addAction(rotateRightAct, "_rotateRight", this, this, SLOT(rotateRight())); rotateLeftAct = new QAction(tr("Rotate to Left"), this); rotateLeftAct->setToolTip(tr("Rotate image counter-clockwise to clockwise")); rotateLeftAct->setEnabled(false); actionsManager->addAction(rotateLeftAct, "_rotateLeft", this, this, SLOT(rotateLeft())); flipVerticallyAct = new QAction(tr("Flip vertically"), this); flipVerticallyAct->setToolTip(tr("Turns vertically the image")); flipVerticallyAct->setEnabled(false); actionsManager->addAction(flipVerticallyAct, "_flipVertically", this, this, SLOT(flipVertically())); flipHorizontallyAct = new QAction(tr("Flip horizontally"), this); flipHorizontallyAct->setToolTip(tr("Reflects the image")); flipHorizontallyAct->setEnabled(false); actionsManager->addAction(flipHorizontallyAct, "_flipHorizontally", this, this, SLOT(flipHorizontally())); aboutAct = new QAction(tr("A&bout"), this); actionsManager->addAction(aboutAct, "_about", this, this, SLOT(about()), QKeySequence::HelpContents); nextAct = new QAction(tr("Ne&xt"), this); nextAct->setStatusTip(tr("Loads next image")); nextAct->setEnabled(false); actionsManager->addAction(nextAct, "_next", this, this, SLOT(next()), Qt::Key_Right); goFirstAct = new QAction(tr("Go to the first"), this); goFirstAct->setStatusTip(tr("Loads the first image in the folder")); goFirstAct->setEnabled(false); actionsManager->addAction(goFirstAct, "_goFirst", this, this, SLOT(goFirst()), Qt::Key_Home); prevAct = new QAction(tr("Pre&vious"), this); prevAct->setStatusTip(tr("Loads previous image")); prevAct->setEnabled(false); actionsManager->addAction(prevAct, "_previous", this, this, SLOT(previous()), Qt::Key_Left); goLastAct = new QAction(tr("Go to the last"), this); goLastAct->setStatusTip(tr("Loads the last image in the folder")); goLastAct->setEnabled(false); actionsManager->addAction(goLastAct, "_goLast", this, this, SLOT(goLast()), Qt::Key_End); openDirAct = new QAction(tr("Open &Folder"), this); openDirAct->setStatusTip("Open a folder to explore images inside it"); actionsManager->addAction(openDirAct, "_openFolder", this, this, SLOT(openDir()), QKeySequence("Ctrl+Shift+O")); showMenuBarAct = new QAction(tr("Show Menu Bar"), this); showMenuBarAct->setCheckable(true); actionsManager->addAction(showMenuBarAct, "_showMenuBar", this, this, SLOT(showMenuBar()), QKeySequence("Ctrl+M")); configAct = new QAction(tr("Configuration"), this); configAct->setEnabled(true); actionsManager->addAction(configAct, "_configuration", this, this, SLOT(configureProgram()), QKeySequence("Ctrl+C")); deleteRecentFilesAct = new QAction(tr("Delete list"), this); deleteRecentFilesAct->setIcon(QIcon::fromTheme("edit-clear")); connect(deleteRecentFilesAct, SIGNAL(triggered()), this, SLOT(deleteRecentFiles())); printAct = new QAction(tr("Print"), this); printAct->setEnabled(false); actionsManager->addAction(printAct, "_print", this, this, SLOT(print()), QKeySequence::Print); deleteFileAct = new QAction(tr("Delete"), this); deleteFileAct->setEnabled(false); deleteFileAct->setToolTip(tr("This deletes completly the file from the disk, doesn't move it to the trash")); actionsManager->addAction(deleteFileAct, "_deleteFile", this, this, SLOT(deleteFileSlot()), QKeySequence::Delete); moveToAct = new QAction(tr("Move to..."), this); moveToAct->setEnabled(false); actionsManager->addAction(moveToAct, "_moveTo", this, this, SLOT(moveToSlot())); goToAct = new QAction(tr("Go to"), this); goToAct->setEnabled(false); actionsManager->addAction(goToAct, "_goTo", this, this, SLOT(goToSlot()), QKeySequence("Ctrl+J")); configureToolBarAct = new QAction(tr("Configure toolbar"), this); actionsManager->addAction(configureToolBarAct, "_configureToolBar", this, this, SLOT(configureToolBarSlot())); //set the icons, becouse QIcon::name() was included in Qt4.7 actionsManager->setActionIcon("_about", "help-about"); actionsManager->setActionIcon("_adjustSize", "zoom-fit-best"); actionsManager->setActionIcon("_configuration", "configure"); actionsManager->setActionIcon("_deleteFile", "edit-delete"); actionsManager->setActionIcon("_exit", "application-exit"); actionsManager->setActionIcon("_fileProperties", "document-properties"); actionsManager->setActionIcon("_flipHorizontally", "object-flip-horizontal"); actionsManager->setActionIcon("_flipVertically", "object-flip-vertical"); actionsManager->setActionIcon("_goFirst", "go-first"); actionsManager->setActionIcon("_goLast", "go-last"); actionsManager->setActionIcon("_goTo", "go-jump"); actionsManager->setActionIcon("_moveTo", "none"); actionsManager->setActionIcon("_next", "go-next"); actionsManager->setActionIcon("_normalSize", "zoom-original"); actionsManager->setActionIcon("_open", "document-open"); actionsManager->setActionIcon("_openFolder", "folder-open"); actionsManager->setActionIcon("_previous", "go-previous"); actionsManager->setActionIcon("_print", "document-print"); actionsManager->setActionIcon("_rotateLeft", "object-rotate-left"); actionsManager->setActionIcon("_rotateRight", "object-rotate-right"); actionsManager->setActionIcon("_save", "document-save"); actionsManager->setActionIcon("_showMenuBar", "show-menu"); actionsManager->setActionIcon("_showToolBar", "configure-toolbars"); actionsManager->setActionIcon("_tbMovable", "configure-toolbars"); actionsManager->setActionIcon("_configureToolBar", "configure-toolbars"); actionsManager->setActionIcon("_zoomIn", "zoom-in"); actionsManager->setActionIcon("_zoomOut", "zoom-out"); }
void WindowPreview::updateTheme() { QLayout *layout = this->layout(); m_background->clearCache(); // frame around preview: qreal hoverLeft = 0, hoverTop = 0, hoverRight = 0, hoverBottom = 0; qreal normalLeft = 0, normalTop = 0, normalRight = 0, normalBottom = 0; m_background->setElementPrefix(HOVER); m_background->getMargins(hoverLeft, hoverTop, hoverRight, hoverBottom); m_background->setElementPrefix(NORMAL); m_background->getMargins(normalLeft, normalTop, normalRight, normalBottom); qreal left = qMax(normalLeft, hoverLeft); qreal top = qMax(normalTop, hoverTop); qreal right = qMax(normalRight, hoverRight); qreal bottom = qMax(normalBottom, hoverBottom); QSizeF normalSize( normalLeft + m_previewSize.width() + normalRight, normalTop + m_previewSize.height() + normalBottom); m_background->setElementPrefix(HOVER); // m_background->resizeFrame(QSizeF( // hoverLeft + m_previewSize.width() + hoverRight, // hoverTop + m_previewSize.height() + hoverBottom)); m_background->resizeFrame(normalSize); m_background->setElementPrefix(NORMAL); m_background->resizeFrame(normalSize); // placeholder for preview: if (m_previewSpace) { m_previewSpace->changeSize( left + m_previewSize.width() + right, top + m_previewSize.height() + bottom, QSizePolicy::Minimum, QSizePolicy::Minimum); m_previewSpace->invalidate(); } layout->invalidate(); layout->activate(); update(); if (KWindowSystem::compositingActive()) { if (m_toolTip->applet()->previewLayout() == Applet::NewPreviewLayout) { m_taskNameLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum); } else { m_taskNameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); } } else { m_taskNameLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); } adjustSize(); }
void ImageViewer::createActions() { openAct = new QAction(tr("&Open..."), this); // openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); printAct = new QAction(tr("&Print..."), this); // printAct->setShortcut(tr("Ctrl+P")); printAct->setEnabled(false); connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); // exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(tr("Zoom &In (10%)"), this); // zoomInAct->setShortcut(tr("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(tr("Zoom &Out (10%)"), this); // zoomOutAct->setShortcut(tr("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(tr("&Normal Size"), this); // normalSizeAct->setShortcut(tr("Ctrl+S")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); fitToWindowAct = new QAction(tr("&Fit to Window"), this); fitToWindowAct->setEnabled(false); fitToWindowAct->setCheckable(true); // fitToWindowAct->setShortcut(tr("Ctrl+F")); connect(fitToWindowAct, SIGNAL(triggered()), this, SLOT(fitToWindow())); aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(tr("About &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); crop = new QAction(tr("Crop"),this); crop->setEnabled(false); connect(crop,SIGNAL(triggered()),this,SLOT(saveSlot())); rotate_left_90 = new QAction(tr("Rotate left"),this); rotate_left_90->setEnabled(false); rotate_right_90 = new QAction(tr("rotate Right"),this); rotate_right_90->setEnabled(false); QSignalMapper *sm = new QSignalMapper(this); connect(rotate_left_90,SIGNAL(triggered()),sm,SLOT(map())); connect(rotate_right_90,SIGNAL(triggered()),sm,SLOT(map())); sm->setMapping(rotate_left_90,90); sm->setMapping(rotate_right_90,-90); connect (sm, SIGNAL(mapped(int)), this, SLOT(rotate_with_angle(int))) ; rotate_custom = new QAction(tr("Custom rotation"),this); rotate_custom->setEnabled(false); connect(rotate_custom,SIGNAL(triggered()),this,SLOT(rotate_custom_slot())); undo = new QAction(tr("Undo"),this); connect(undo,SIGNAL(triggered()),this,SLOT(undo_slot())); redo = new QAction(tr("Redo"),this); connect(redo,SIGNAL(triggered()),this,SLOT(redo_slot())); reset = new QAction(tr("Reset"),this); connect(reset,SIGNAL(triggered()),this,SLOT(reset_slot())); reset->setEnabled(false); QToolBar *tb = new QToolBar ; saveAs = new QAction(tr("Save As"),this); connect(saveAs,SIGNAL(triggered()),this,SLOT(saveAs_slot())); tb->addAction(openAct); tb->addAction(zoomInAct); tb->addAction(zoomOutAct); tb->addAction(crop); tb->addAction(rotate_left_90); tb->addAction(rotate_right_90); tb->addAction(undo); tb->addAction(redo); tb->addAction(reset); addToolBar(tb); }
Void PlaYUVerApp::createActions() { m_arrayActions.resize( TOTAL_ACT ); // ------------ File ------------ m_arrayActions[OPEN_ACT] = new QAction( QIcon( ":/images/open.png" ), tr( "&Open" ), this ); m_arrayActions[OPEN_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogOpenButton ) ); m_arrayActions[OPEN_ACT]->setShortcuts( QKeySequence::Open ); m_arrayActions[OPEN_ACT]->setStatusTip( tr( "Open stream" ) ); connect( m_arrayActions[OPEN_ACT], SIGNAL( triggered() ), this, SLOT( open() ) ); m_arrayRecentFilesActions.resize( MAX_RECENT_FILES ); for( Int i = 0; i < MAX_RECENT_FILES; i++ ) { m_arrayRecentFilesActions[i] = new QAction( this ); m_arrayRecentFilesActions[i]->setVisible( false ); connect( m_arrayRecentFilesActions[i], SIGNAL( triggered() ), this, SLOT( openRecent() ) ); } m_arrayActions[SAVE_ACT] = new QAction( QIcon( ":/images/save.png" ), tr( "&Save Frame" ), this ); m_arrayActions[SAVE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogSaveButton ) ); m_arrayActions[SAVE_ACT]->setShortcuts( QKeySequence::SaveAs ); m_arrayActions[SAVE_ACT]->setStatusTip( tr( "Save current frame" ) ); connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( save() ) ); m_arrayActions[FORMAT_ACT] = new QAction( tr( "&Format" ), this ); m_arrayActions[FORMAT_ACT]->setIcon( QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) ); m_arrayActions[FORMAT_ACT]->setShortcut( Qt::CTRL + Qt::Key_F ); m_arrayActions[FORMAT_ACT]->setStatusTip( tr( "Open format dialog" ) ); connect( m_arrayActions[FORMAT_ACT], SIGNAL( triggered() ), this, SLOT( format() ) ); m_arrayActions[RELOAD_ACT] = new QAction( tr( "&Reload" ), this ); m_arrayActions[RELOAD_ACT]->setIcon( style()->standardIcon( QStyle::SP_BrowserReload ) ); m_arrayActions[RELOAD_ACT]->setShortcut( Qt::CTRL + Qt::Key_R ); m_arrayActions[RELOAD_ACT]->setShortcut( Qt::Key_F5 ); m_arrayActions[RELOAD_ACT]->setStatusTip( tr( "Reload current sequence" ) ); connect( m_arrayActions[RELOAD_ACT], SIGNAL( triggered() ), this, SLOT( reload() ) ); m_arrayActions[RELOAD_ALL_ACT] = new QAction( tr( "Reload All" ), this ); m_arrayActions[RELOAD_ALL_ACT]->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_R ); m_arrayActions[RELOAD_ALL_ACT]->setStatusTip( tr( "Reload all sequences" ) ); connect( m_arrayActions[RELOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( reloadAll() ) ); m_arrayActions[LOAD_ALL_ACT] = new QAction( tr( "Preload" ), this ); m_arrayActions[LOAD_ALL_ACT]->setStatusTip( tr( "Load sequence into memory (caution)" ) ); connect( m_arrayActions[LOAD_ALL_ACT], SIGNAL( triggered() ), this, SLOT( loadAll() ) ); m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this ); m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) ); m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) ); connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeActiveSubWindow() ) ); m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this ); m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) ); connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeAllSubWindow() ) ); m_arrayActions[EXIT_ACT] = new QAction( tr( "E&xit" ), this ); m_arrayActions[EXIT_ACT]->setShortcuts( QKeySequence::Quit ); m_arrayActions[EXIT_ACT]->setStatusTip( tr( "Exit the application" ) ); connect( m_arrayActions[EXIT_ACT], SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ) ); // ------------ View ------------ mapperZoom = new QSignalMapper( this ); connect( mapperZoom, SIGNAL( mapped(int) ), this, SLOT( scaleFrame(int) ) ); m_arrayActions[ZOOM_IN_ACT] = new QAction( tr( "Zoom &In (+25%)" ), this ); m_arrayActions[ZOOM_IN_ACT]->setIcon( QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) ); m_arrayActions[ZOOM_IN_ACT]->setShortcut( tr( "Ctrl++" ) ); m_arrayActions[ZOOM_IN_ACT]->setStatusTip( tr( "Scale the image up by 25%" ) ); connect( m_arrayActions[ZOOM_IN_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) ); mapperZoom->setMapping( m_arrayActions[ZOOM_IN_ACT], 125 ); m_arrayActions[ZOOM_OUT_ACT] = new QAction( tr( "Zoom &Out (-25%)" ), this ); m_arrayActions[ZOOM_OUT_ACT]->setIcon( QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) ); m_arrayActions[ZOOM_OUT_ACT]->setShortcut( tr( "Ctrl+-" ) ); m_arrayActions[ZOOM_OUT_ACT]->setStatusTip( tr( "Scale the image down by 25%" ) ); connect( m_arrayActions[ZOOM_OUT_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) ); mapperZoom->setMapping( m_arrayActions[ZOOM_OUT_ACT], 80 ); m_arrayActions[ZOOM_NORMAL_ACT] = new QAction( tr( "&Normal Size" ), this ); m_arrayActions[ZOOM_NORMAL_ACT]->setIcon( QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) ); m_arrayActions[ZOOM_NORMAL_ACT]->setShortcut( tr( "Ctrl+N" ) ); m_arrayActions[ZOOM_NORMAL_ACT]->setStatusTip( tr( "Show the image at its original size" ) ); connect( m_arrayActions[ZOOM_NORMAL_ACT], SIGNAL( triggered() ), this, SLOT( normalSize() ) ); m_arrayActions[ZOOM_FIT_ACT] = new QAction( tr( "Zoom to &Fit" ), this ); m_arrayActions[ZOOM_FIT_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) ); m_arrayActions[ZOOM_FIT_ACT]->setStatusTip( tr( "Zoom in or out to fit on the window." ) ); connect( m_arrayActions[ZOOM_FIT_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFit() ) ); m_arrayActions[ZOOM_FIT_ALL_ACT] = new QAction( tr( "Zoom to Fit All" ), this ); //m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) ); m_arrayActions[ZOOM_FIT_ALL_ACT]->setStatusTip( tr( "Apply zoom to fit to all windows" ) ); connect( m_arrayActions[ZOOM_FIT_ALL_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFitAll() ) ); m_appModuleVideo->createActions(); m_appModuleQuality->createActions(); m_appModuleExtensions->createActions(); m_pcWindowHandle->createActions(); // ------------ About ------------ #ifdef USE_FERVOR m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this ); m_arrayActions[UPDATE_ACT]->setStatusTip( tr( "Check for updates" ) ); connect( m_arrayActions[UPDATE_ACT], SIGNAL( triggered() ), FvUpdater::sharedUpdater(), SLOT( CheckForUpdatesNotSilent() ) ); #endif m_arrayActions[ABOUT_ACT] = new QAction( tr( "&About" ), this ); m_arrayActions[ABOUT_ACT]->setStatusTip( tr( "Show the application's About box" ) ); connect( m_arrayActions[ABOUT_ACT], SIGNAL( triggered() ), this, SLOT( about() ) ); m_arrayActions[ABOUTQT_ACT] = new QAction( tr( "About &Qt" ), this ); m_arrayActions[ABOUTQT_ACT]->setIcon( QIcon( ":images/qt.png" ) ); m_arrayActions[ABOUTQT_ACT]->setStatusTip( tr( "Show the Qt library's About box" ) ); connect( m_arrayActions[ABOUTQT_ACT], SIGNAL( triggered() ), qApp, SLOT( aboutQt() ) ); }
/* * Menüpunkte erstellen */ void ProtoWindow::createActions() { openAct = new QAction(trUtf8("Ö&ffnen..."), this); openAct->setShortcut(trUtf8("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); // TODO bei Speichern über STRG-S vermutlich nicht mehr nachfragen saveAct = new QAction(trUtf8("&Speichern"), this); saveAct->setShortcut(trUtf8("Ctrl+S")); saveAct->setEnabled(false); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); saveAsAct = new QAction(trUtf8("Speichern unter..."), this); saveAsAct->setEnabled(false); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); //printAct = new QAction(trUtf8("&Drucken..."), this); //printAct->setShortcut(trUtf8("Ctrl+P")); //printAct->setEnabled(false); //connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(trUtf8("&Beenden"), this); exitAct->setShortcut(trUtf8("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); zoomInAct = new QAction(trUtf8("ver&größern (25%)"), this); zoomInAct->setShortcut(trUtf8("Ctrl++")); zoomInAct->setEnabled(false); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); zoomOutAct = new QAction(trUtf8("ver&kleinern (25%)"), this); zoomOutAct->setShortcut(trUtf8("Ctrl+-")); zoomOutAct->setEnabled(false); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); normalSizeAct = new QAction(trUtf8("&Normale Größe"), this); normalSizeAct->setShortcut(trUtf8("Ctrl+N")); normalSizeAct->setEnabled(false); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); autoNormalSizeAct = new QAction(trUtf8("immer auf normale Größe einpassen"), this); autoNormalSizeAct->setCheckable(true); autoNormalSizeAct->setChecked(true); connect(autoNormalSizeAct, SIGNAL(triggered()), this, SLOT(autoNormalSize())); actualSizeAct = new QAction(trUtf8("&Tatsächliche Größe"), this); actualSizeAct->setShortcut(trUtf8("Ctrl+T")); actualSizeAct->setEnabled(false); connect(actualSizeAct, SIGNAL(triggered()), this, SLOT(actualSize())); invertImageAct = new QAction(trUtf8("Farben &invertieren"), this); invertImageAct->setEnabled(false); invertImageAct->setShortcut(trUtf8("I")); connect(invertImageAct, SIGNAL(triggered()), this, SLOT(invertImage())); rotateLeftAct = new QAction(trUtf8("90°-Drehung links"), this); rotateLeftAct->setEnabled(false); rotateLeftAct->setShortcut(trUtf8("Ctrl+Left")); connect(rotateLeftAct, SIGNAL(triggered()), this, SLOT(rotateLeft())); rotateRightAct = new QAction(trUtf8("90°-Drehung rechts"), this); rotateRightAct->setEnabled(false); rotateRightAct->setShortcut(trUtf8("Ctrl+Right")); connect(rotateRightAct, SIGNAL(triggered()), this, SLOT(rotateRight())); aboutAct = new QAction(trUtf8("&Über..."), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutQtAct = new QAction(trUtf8("Über &Qt"), this); connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); }
void MainWindow::createElements() { QMenu *fileMenu = new QMenu(tr("&File"), this); menuBar()->addMenu(fileMenu); QMenu *viewMenu = new QMenu(tr("&View"), this); menuBar()->addMenu(viewMenu); QMenu *selectMenu = new QMenu(tr("&Selection"), this); menuBar()->addMenu(selectMenu); QMenu *helpMenu = new QMenu(tr("&Help"), this); menuBar()->addMenu(helpMenu); QAction *openAct = new QAction(tr("&Open..."), this); openAct->setShortcut(tr("Ctrl+O")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); fileMenu->addAction(openAct); QAction *exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); fileMenu->addAction(exitAct); QAction *zoomInAct = new QAction(tr("Zoom &In (25%)"), this); zoomInAct->setShortcut(tr("Ctrl++")); connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn())); viewMenu->addAction(zoomInAct); QAction *zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this); zoomOutAct->setShortcut(tr("Ctrl+-")); connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut())); viewMenu->addAction(zoomOutAct); QAction *normalSizeAct = new QAction(tr("&Normal Size"), this); normalSizeAct->setShortcut(tr("Ctrl+0")); connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize())); viewMenu->addAction(normalSizeAct); QAction *flipSectAct = new QAction(tr("&Show/Hide Section"), this); flipSectAct->setShortcut(tr("Ctrl+J")); connect(flipSectAct, SIGNAL(triggered()), this, SLOT(flipSectWin())); viewMenu->addAction(flipSectAct); QAction *flipSpecAct = new QAction(tr("&Show/Hide Spectrum"), this); flipSpecAct->setShortcut(tr("Ctrl+K")); connect(flipSpecAct, SIGNAL(triggered()), this, SLOT(flipSpecWin())); viewMenu->addAction(flipSpecAct); QAction *flipMainOptAct = new QAction(tr("&Show/Hide Image Viewer Options"), this); flipMainOptAct->setShortcut(tr("Ctrl+L")); connect(flipMainOptAct, SIGNAL(triggered()), this, SLOT(flipMainOpt())); viewMenu->addAction(flipMainOptAct); QAction *flipSectOptAct = new QAction(tr("&Show/Hide Section Viewer Options"), this); flipSectOptAct->setShortcut(tr("Ctrl+L")); connect(flipSectOptAct, SIGNAL(triggered()), this, SLOT(flipSectOpt())); viewMenu->addAction(flipSectOptAct); QAction *popAct = new QAction(tr("&Delete Last Point"), this); popAct->setShortcut(tr("Ctrl+N")); connect(popAct, SIGNAL(triggered()), this, SLOT(popPoint())); selectMenu->addAction(popAct); QAction *clearAct = new QAction(tr("&Delete All Points"), this); clearAct->setShortcut(tr("Ctrl+M")); connect(clearAct, SIGNAL(triggered()), this, SLOT(clearPoints())); selectMenu->addAction(clearAct); QAction *aboutAct = new QAction(tr("&About"), this); connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); helpMenu->addAction(aboutAct); connect(m_maincan, SIGNAL(sample()), this, SLOT(sample())); connect(m_maincan, SIGNAL(moved(float, float)), this, SLOT(showMainPixel(float, float))); connect(m_sectwin, SIGNAL(moved(float, float)), this, SLOT(mapSect(float, float))); }