From a17f1393214a83a403aa1c6bc0fa1ecacc6e1511 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 11 Apr 2021 12:54:18 +0100 Subject: [PATCH] midipattern: use Esc key to close UI Signed-off-by: falkTX --- resources/ui/midipattern.ui | 5 ++++- source/frontend/widgets/pianoroll.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/ui/midipattern.ui b/resources/ui/midipattern.ui index a982f3092..a161b2aba 100644 --- a/resources/ui/midipattern.ui +++ b/resources/ui/midipattern.ui @@ -403,7 +403,7 @@ 0 0 755 - 20 + 23 @@ -428,6 +428,9 @@ &Quit + + Esc + diff --git a/source/frontend/widgets/pianoroll.py b/source/frontend/widgets/pianoroll.py index 6e60eabdb..386014f65 100755 --- a/source/frontend/widgets/pianoroll.py +++ b/source/frontend/widgets/pianoroll.py @@ -24,7 +24,7 @@ from PyQt5.QtCore import Qt, QRectF, QPointF, pyqtSignal from PyQt5.QtGui import QColor, QCursor, QFont, QPen, QPainter, QTransform from PyQt5.QtWidgets import QGraphicsItem, QGraphicsLineItem, QGraphicsOpacityEffect, QGraphicsRectItem, QGraphicsSimpleTextItem from PyQt5.QtWidgets import QGraphicsScene, QGraphicsView -from PyQt5.QtWidgets import QWidget, QLabel, QComboBox, QHBoxLayout, QVBoxLayout, QStyle +from PyQt5.QtWidgets import QApplication, QComboBox, QHBoxLayout, QLabel, QStyle, QVBoxLayout, QWidget # ------------------------------------------------------------------------------------------------------------ # Imports (Custom) @@ -474,6 +474,10 @@ class PianoRoll(QGraphicsScene): def keyPressEvent(self, event): QGraphicsScene.keyPressEvent(self, event) + if event.key() == Qt.Key_Escape: + QApplication.instance().closeAllWindows() + return + if event.key() == Qt.Key_F: if not self.insert_mode: # turn off velocity mode