X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=662d68af2f29bdba5ceff5f68931855d18708026;hp=857898c52e98b514440fd3f561babe8def1894cc;hb=763945bb95fb3f5871d8b8241c8d9db2f0f66d4c;hpb=85715407f784767052238586f4e7f64440b7693e diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 857898c5..662d68af 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "mainwindow.hpp" @@ -370,9 +371,11 @@ void MainWindow::setup_ui() run_stop_button_ = new QToolButton(); run_stop_button_->setAutoRaise(true); run_stop_button_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - run_stop_button_->setShortcut(QKeySequence(Qt::Key_Space)); run_stop_button_->setToolTip(tr("Start/Stop Acquisition")); + run_stop_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Space), run_stop_button_, SLOT(click())); + run_stop_shortcut_->setAutoRepeat(false); + settings_button_ = new QToolButton(); settings_button_->setIcon(QIcon::fromTheme("configure", QIcon(":/icons/configure.png"))); @@ -398,6 +401,11 @@ void MainWindow::setup_ui() session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner); session_selector_.setTabsClosable(true); + close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close())); + close_application_shortcut_->setAutoRepeat(false); + + close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this, SLOT(on_close_current_tab())); + connect(new_session_button_, SIGNAL(clicked(bool)), this, SLOT(on_new_session_clicked())); connect(run_stop_button_, SIGNAL(clicked(bool)), @@ -739,4 +747,11 @@ void MainWindow::on_actionAbout_triggered() dlg.exec(); } +void MainWindow::on_close_current_tab() +{ + int tab = session_selector_.currentIndex(); + + on_tab_close_requested(tab); +} + } // namespace pv