aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorq5sys <jt@obs-sec.com>2017-06-05 12:15:58 -0400
committerq5sys <jt@obs-sec.com>2017-06-05 12:15:58 -0400
commit85d42838d511ab068194ce2b2113b1fe0c287fb0 (patch)
tree4332d1c0ecb5f541ff644e8a3404fa56c0d61c72
parentadd quit and open shortcuts to screenshot (diff)
downloadlumina-85d42838d511ab068194ce2b2113b1fe0c287fb0.tar.gz
lumina-85d42838d511ab068194ce2b2113b1fe0c287fb0.tar.bz2
lumina-85d42838d511ab068194ce2b2113b1fe0c287fb0.zip
add quit and clear shortcuts to calculator
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.cpp11
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.h6
2 files changed, 17 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
index 6ba7450b..a0b1416e 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
@@ -55,6 +55,12 @@ mainUI::mainUI() : QMainWindow(), ui(new Ui::mainUI()){
updateMenus();
ui->line_eq->setFocus();
ui->line_eq->setValidator(new EqValidator(this) );
+
+ // shortcuts
+ escShortcut = new QShortcut(Qt::Key_Escape, this);
+ connect(escShortcut, SIGNAL(activated()), this, SLOT(clear_calc()) );
+ quitShortcut = new QShortcut(Qt::CTRL + Qt::Key_Q, this);
+ connect(quitShortcut, SIGNAL(activated()), this, SLOT(on_quitShortcut_Triggered()) );
}
mainUI::~mainUI(){
@@ -337,3 +343,8 @@ QString mainUI::getHistory(int number){
return ("("+eq+")");
}
}
+
+void mainUI::on_quitShortcut_Triggered(){
+ QApplication::quit();
+}
+
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.h b/src-qt5/desktop-utils/lumina-calculator/mainUI.h
index f05365f3..308eab30 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.h
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.h
@@ -11,6 +11,7 @@
#include <QString>
#include <QChar>
#include <QListWidgetItem>
+#include <QShortcut>
namespace Ui{
class mainUI;
@@ -53,6 +54,8 @@ private slots:
void saveHistory();
+ void on_quitShortcut_Triggered();
+
private:
Ui::mainUI *ui;
QMenu *advMenu;
@@ -61,5 +64,8 @@ private:
double performSciOperation(QString func, double arg);
double strToNumber(QString str); //this is highly-recursive
QString getHistory(int number = -1);
+
+ QShortcut *quitShortcut, *escShortcut;
+
};
#endif
bgstack15