From b2bdae2c2d48f28e102c84826800996ff4f02ed2 Mon Sep 17 00:00:00 2001 From: donoban Date: Sun, 25 Nov 2018 19:28:07 +0100 Subject: [PATCH] Clear searchbox pressing esc without need of selecting it --- qubesmanager/qube_manager.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qubesmanager/qube_manager.py b/qubesmanager/qube_manager.py index d031840..2d2221f 100644 --- a/qubesmanager/qube_manager.py +++ b/qubesmanager/qube_manager.py @@ -70,11 +70,6 @@ class SearchBox(QtGui.QLineEdit): self.selectAll() self.focusing = False - def keyPressEvent(self, event): # pylint: disable=invalid-name - if event.key() == QtCore.Qt.Key_Escape: - self.clear() - super(SearchBox, self).keyPressEvent(event) - class VmRowInTable: # pylint: disable=too-few-public-methods @@ -479,6 +474,11 @@ class VmManagerWindow(ui_qubemanager.Ui_VmManagerWindow, QtGui.QMainWindow): timer.start(1000 * 30) # 30s self.check_updates() + def keyPressEvent(self, event): # pylint: disable=invalid-name + if event.key() == QtCore.Qt.Key_Escape: + self.searchbox.clear() + super(VmManagerWindow, self).keyPressEvent(event) + def clear_threads(self): for thread in self.threads_list: if thread.isFinished():