From 45cb64fff7ebf16381bb567e33c22a9ff6f78cd8 Mon Sep 17 00:00:00 2001 From: Piotr Esden-Tempski Date: Thu, 2 Mar 2017 17:55:55 -0800 Subject: [PATCH] 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. --- pv/mainwindow.cpp | 5 ++++- pv/mainwindow.hpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 -- 2.30.2