]> git.sesse.net Git - nageru/commitdiff
Make so that the 0 key maps to preview of the 10th input.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 21 Apr 2018 09:34:34 +0000 (11:34 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 21 Apr 2018 09:34:34 +0000 (11:34 +0200)
mainwindow.cpp

index 077942ec11afdaea8c6c2ec84d8b8291928f15cc..9f61c36ebe1b5497afd7ff5524246b4f3830646f 100644 (file)
@@ -321,8 +321,15 @@ void MainWindow::mixer_created(Mixer *mixer)
                connect(ui_display->display, &GLWidget::color_updated, this, &MainWindow::update_channel_color);
 
                // Hook up the keyboard key.
-               QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this);
-               connect(shortcut, &QShortcut::activated, bind(&MainWindow::channel_clicked, this, i));
+               QShortcut *shortcut = nullptr;
+               if (i < 9) {
+                       shortcut = new QShortcut(QKeySequence(Qt::Key_1 + i), this);
+               } else if (i == 9) {
+                       shortcut = new QShortcut(QKeySequence(Qt::Key_0), this);
+               }
+               if (shortcut != nullptr) {
+                       connect(shortcut, &QShortcut::activated, bind(&MainWindow::channel_clicked, this, i));
+               }
 
                // Hook up the quick-cut key.
                if (i < strlen(qwerty)) {