Add exit option in connection menu

This commit is contained in:
atse 2023-10-30 11:30:55 +08:00
parent 7c1293e3d2
commit 98d491203f

View File

@ -343,6 +343,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.connection_menu.addAction(port) self.connection_menu.addAction(port)
self.connection_menu.port = 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) self.connect_btn.setMenu(self.connection_menu)
def _set_up_thermostat_menu(self): def _set_up_thermostat_menu(self):