From: Piotr Esden-Tempski Date: Fri, 3 Mar 2017 01:55:55 +0000 (-0800) Subject: Add Run/Stop shortcut. X-Git-Tag: pulseview-0.4.0~181 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=45cb64fff7ebf16381bb567e33c22a9ff6f78cd8;p=pulseview.git Add Run/Stop shortcut. This is a proposed solution to reenable the shortcut for Run/Stop. It seems that setShortcut on QToolButton is not working, but it seems that adding QShortcut works as a workaround. --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 857898c5..ddc2c8f0 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"))); diff --git a/pv/mainwindow.hpp b/pv/mainwindow.hpp index 93945d18..9ba532bf 100644 --- a/pv/mainwindow.hpp +++ b/pv/mainwindow.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "session.hpp" #include "views/viewbase.hpp" @@ -151,6 +152,8 @@ private: QIcon icon_red_; QIcon icon_green_; QIcon icon_grey_; + + QShortcut *run_stop_shortcut_; }; } // namespace pv