From 98d491203f6f15f8e5abc1b9c27b1d655983c3b3 Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 30 Oct 2023 11:30:55 +0800 Subject: [PATCH] Add exit option in connection menu --- pytec/tec_qt.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index d28d97a..8ece05b 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -343,6 +343,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.connection_menu.addAction(port) self.connection_menu.port = port + self.exit_button = QtWidgets.QPushButton() + self.exit_button.setText("Exit") + self.exit_button.pressed.connect(QtWidgets.QApplication.instance().quit) + + exit_action = QtWidgets.QWidgetAction(self.exit_button) + exit_action.setDefaultWidget(self.exit_button) + self.connection_menu.addAction(exit_action) + self.connection_menu.exit_action = exit_action + self.connect_btn.setMenu(self.connection_menu) def _set_up_thermostat_menu(self):