From beaf3b70701f7c8a1f7e55549aba2a3d4cfb2ad8 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Sun, 7 Jun 2015 18:55:01 +0200 Subject: [PATCH] add some keyboard shortcuts --- qtosd/qtosd.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/qtosd/qtosd.py b/qtosd/qtosd.py index 997934d..35e4e75 100644 --- a/qtosd/qtosd.py +++ b/qtosd/qtosd.py @@ -679,6 +679,25 @@ class Ui_MainWindow(QMainWindow): self.ui.yawSlider.valueChanged[int].connect(self.changeYaw) self.ui.actionExit.triggered.connect(self.close) + def keyPressEvent(self, event): + if event.key() == Qt.Key_J: + self.osd.setRoll(self.osd.user_roll + 2) + event.accept() + elif event.key() == Qt.Key_L: + self.osd.setRoll(self.osd.user_roll - 2) + event.accept() + elif event.key() == Qt.Key_I: + self.osd.setPitch(self.osd.user_pitch + 2) + event.accept() + elif event.key() == Qt.Key_K: + self.osd.setPitch(self.osd.user_pitch - 2) + event.accept() + elif event.key() == Qt.Key_Q: + self.close() + + def keyReleaseEvent(self, event): + return + def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) -- 2.39.5