]> sigrok.org Git - pulseview.git/commitdiff
Add Run/Stop shortcut.
authorPiotr Esden-Tempski <redacted>
Fri, 3 Mar 2017 01:55:55 +0000 (17:55 -0800)
committerUwe Hermann <redacted>
Fri, 3 Mar 2017 20:45:49 +0000 (21:45 +0100)
This is a proposed solution to reenable the <Space> 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
pv/mainwindow.hpp

index 857898c52e98b514440fd3f561babe8def1894cc..ddc2c8f0435c798039ab369830a3368c148a23dc 100644 (file)
@@ -34,6 +34,7 @@
 #include <QMessageBox>
 #include <QSettings>
 #include <QWidget>
+#include <QShortcut>
 
 #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")));
index 93945d189f11c25f60361dfbce6a808d5280139b..9ba532bf6cc8fc3e15a23efd826d36515ebd6383 100644 (file)
@@ -28,6 +28,7 @@
 #include <QSignalMapper>
 #include <QToolButton>
 #include <QTabWidget>
+#include <QShortcut>
 
 #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