LargePhotoView::LargePhotoView(QString path, QWidget *parent, ThumbnailView *listArea) : QWidget(parent) { layout = new QGridLayout(this); this->listArea = listArea; fullscreen = false; photoWidget = new LargePhotoWidget(path,this); layout->addWidget(photoWidget,1,0); toolbar = new QToolBar("",this); layout->addWidget(toolbar,2,0); setLayout(layout); QString shortCut("O"); QAction *action = toolbar->addAction(QIcon::fromTheme("folder"),getShortcutLabel("Open in file manager",shortCut), this,SLOT(openInFileManager())); action->setShortcut(QKeySequence(shortCut)); shortCut = QString("E"); action = toolbar->addAction(QIcon::fromTheme("image-x-generic"),getShortcutLabel("Edit photo in other application",shortCut), this,SLOT(editPhoto())); action->setShortcut(QKeySequence(shortCut)); toolbar->addSeparator(); shortCut = QString("Ctrl+Shift+R"); action = toolbar->addAction(QIcon::fromTheme("object-rotate-left"),getShortcutLabel("Rotate anti-clockwise",shortCut), this,SLOT(rotatePhotoAntiClockwise())); action->setShortcut(QKeySequence(shortCut)); shortCut = QString("Ctrl+R"); action = toolbar->addAction(QIcon::fromTheme("object-rotate-right"),getShortcutLabel("Rotate clockwise",shortCut), this,SLOT(rotatePhotoClockwise())); action->setShortcut(QKeySequence(shortCut)); toolbar->addSeparator(); shortCut = QString("Escape"); action = toolbar->addAction(QIcon::fromTheme("go-up"),getShortcutLabel("Back to event",shortCut), this,SLOT(backAction())); action->setShortcut(QKeySequence(shortCut)); shortCut = QString("Left"); action = toolbar->addAction(QIcon::fromTheme("go-previous"),getShortcutLabel("Previous photo",shortCut), this,SLOT(prevPhoto())); action->setShortcut(QKeySequence(shortCut)); shortCut = QString("Right"); action = toolbar->addAction(QIcon::fromTheme("go-next"),getShortcutLabel("Next photo",shortCut), this,SLOT(nextPhoto())); action->setShortcut(QKeySequence(shortCut)); toolbar->addSeparator(); shortCut = QString("F11"); action = toolbar->addAction(QIcon::fromTheme("view-fullscreen"),getShortcutLabel("Toggle Fullscreen",shortCut),this,SLOT(toggleFullscreen())); action->setShortcut(QKeySequence(shortCut)); connect(photoWidget,SIGNAL(doubleClicked()),this,SLOT(toggleFullscreen())); setFocus(); }
void FormMain::treeContextMenu( const QPoint & ) { QMenu menu; QAction * actionOpenInFileManager = menu.addAction( tr("Open in file manager"), this, SLOT( openInFileManager() ) ); QTreeWidgetItem * item = tree->currentItem(); if ( ! item ) actionOpenInFileManager->setEnabled( false ); menu.exec( QCursor::pos() ); }