changeset 32:179239c94740

(issue7-8) Add shortcuts for play/pause and next
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 15:31:54 +0200
parents 749ecdfd036a
children 58f1b3c330af
files src/mainwindow.cpp src/mainwindow.h
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Wed May 06 15:30:47 2015 +0200
+++ b/src/mainwindow.cpp	Wed May 06 15:31:54 2015 +0200
@@ -34,6 +34,8 @@
 #include <QStatusBar>
 #include <QTabWidget>
 #include <QVBoxLayout>
+#include <QShortcut>
+#include <QKeySequence>
 
 MainWindow::MainWindow() :
     mDataView(NULL) {
@@ -43,6 +45,7 @@
     setupGUI();
     readSettings();
     setAcceptDrops(true);
+    setupShortcuts();
     //QIcon windowIcon = QIcon(":/icon-64.png");
     //setWindowIcon(windowIcon);
 
@@ -199,3 +202,13 @@
     fsDialog->show();
    // connect(fsDialog, &QDialog::closeEvent, fsDialog, &QObject::deleteLater);
 }
+
+void MainWindow::setupShortcuts() {
+    QShortcut *next = new QShortcut(Qt::Key_Right, this);
+    QShortcut *prev = new QShortcut(Qt::Key_Left, this);
+    QShortcut *pause = new QShortcut(Qt::Key_Space, this);
+
+    connect(pause, &QShortcut::activated, mPlayer, &PNGPlayer::togglePlay);
+    connect(next, &QShortcut::activated, mDataView, &MetaDataView::selectNextRow);
+    connect(prev, &QShortcut::activated, mDataView, &MetaDataView::selectPrevRow);
+}
--- a/src/mainwindow.h	Wed May 06 15:30:47 2015 +0200
+++ b/src/mainwindow.h	Wed May 06 15:31:54 2015 +0200
@@ -46,6 +46,9 @@
     void dragLeaveEvent(QDragLeaveEvent *event);
     void dropEvent(QDropEvent *event);
  */
+
+    void setupShortcuts();
+
 public slots:
     /** @brief set an absolute folder to read a metadata.csv from. */
     void setFolder(const QString &folder);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)