From 8a9455f522b3d6eaad094c5bfaf89000e6ae1a55 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 25 Oct 2015 23:14:11 +0100 Subject: [PATCH] Add some keyboard shortcuts for selecting preview. --- mainwindow.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 65db8cf..0289dbf 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "context.h" #include "mixer.h" @@ -37,6 +38,23 @@ MainWindow::MainWindow() connect(ui->preview1, SIGNAL(clicked()), mapper, SLOT(map())); connect(ui->preview2, SIGNAL(clicked()), mapper, SLOT(map())); connect(ui->preview3, SIGNAL(clicked()), mapper, SLOT(map())); + + connect(mapper, SIGNAL(mapped(int)), this, SLOT(channel_clicked(int))); + } + + // Hook up the preview keyboard keys. + { + QSignalMapper *mapper = new QSignalMapper(this); + QShortcut *shortcut1 = new QShortcut(QKeySequence(Qt::Key_1), this); + connect(shortcut1, SIGNAL(activated()), mapper, SLOT(map())); + QShortcut *shortcut2 = new QShortcut(QKeySequence(Qt::Key_2), this); + connect(shortcut2, SIGNAL(activated()), mapper, SLOT(map())); + QShortcut *shortcut3 = new QShortcut(QKeySequence(Qt::Key_3), this); + connect(shortcut3, SIGNAL(activated()), mapper, SLOT(map())); + mapper->setMapping(shortcut1, 0), + mapper->setMapping(shortcut2, 1); + mapper->setMapping(shortcut3, 2); + connect(mapper, SIGNAL(mapped(int)), this, SLOT(channel_clicked(int))); } -- 2.39.5