diff src/mainwindow.cpp @ 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 64a51a42c01f
children 58f1b3c330af
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);
+}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)