]> git.sesse.net Git - nageru/blobdiff - mainwindow.cpp
Make it possible to use PgUp/PgDown to switch audio pages.
[nageru] / mainwindow.cpp
index 3245fdde0254c75e8505e52bbfa0a4fcd568449c..e62594dc04554cb002d3e9c1bb4574b1c5d0658e 100644 (file)
@@ -189,6 +189,13 @@ MainWindow::MainWindow()
        connect(ui->full_prev_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
        connect(ui->full_next_page, &QAbstractButton::clicked, bind(&QStackedWidget::setCurrentIndex, ui->audio_views, 0));
 
+       // And bind the same to PgUp/PgDown.
+       auto switch_page = [this]{
+               ui->audio_views->setCurrentIndex(1 - ui->audio_views->currentIndex());
+       };
+       connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, switch_page);
+       connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, switch_page);
+
        last_audio_level_callback = steady_clock::now() - seconds(1);
 }