From 26ff0a6f5b4ea19657f851a82a8d679f10d19edb Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Mon, 16 Feb 2015 13:17:29 +0100 Subject: [PATCH] Add some hotkeys --- src/gui/Mainwindow.cxx | 12 ++++++++++++ src/gui/Mainwindow.hxx | 1 + src/gui/qt.hxx | 1 + 3 files changed, 14 insertions(+) diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 611f3da..754d5b2 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -62,6 +62,18 @@ Mainwindow::Mainwindow(InformationManager* mgr) auto item = new QListWidgetItem(name.c_str(), listWidget); item->setBackground(QBrush(QColor(0xff, 0xdd, 0xdd))); }); + setGlobalHotkeys(); +} + +void Mainwindow::setGlobalHotkeys() { + QShortcut *shortcut = new QShortcut(QKeySequence("f"), this); + connect(shortcut, &QShortcut::activated, this, &Mainwindow::requestNewFunction); + + shortcut = new QShortcut(QKeySequence("r"), listWidget); + connect(shortcut, &QShortcut::activated, [=]() { + QListWidgetItem * item = listWidget->currentItem(); + if (item) renameFunction(item); + }); } void Mainwindow::quit() diff --git a/src/gui/Mainwindow.hxx b/src/gui/Mainwindow.hxx index a78b446..179a9c4 100644 --- a/src/gui/Mainwindow.hxx +++ b/src/gui/Mainwindow.hxx @@ -25,6 +25,7 @@ public: private: void addFunction(Function* fun); + void setGlobalHotkeys(); QTextEdit *textEdit; QPushButton *quitButton; diff --git a/src/gui/qt.hxx b/src/gui/qt.hxx index 64ca4c1..97a1d28 100644 --- a/src/gui/qt.hxx +++ b/src/gui/qt.hxx @@ -24,5 +24,6 @@ #include #include #include +#include #endif /* INCLUDE__qt_hxx_ */ -- 2.39.2