From cf49e8659e61f287c51a326fd1eb32839106c6db Mon Sep 17 00:00:00 2001 From: DS_Litvinov Date: Thu, 20 Nov 2025 16:25:49 +0300 Subject: [PATCH] Add confirmation dialog for unsaved changes on close Implemented a check for unsaved changes in the close event of the main window. Users are prompted to confirm if they wish to quit without saving, preventing accidental data loss. --- beeref/__main__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/beeref/__main__.py b/beeref/__main__.py index bc9dd58..84f29d9 100755 --- a/beeref/__main__.py +++ b/beeref/__main__.py @@ -64,6 +64,15 @@ class BeeRefMainWindow(QtWidgets.QMainWindow): self.show() def closeEvent(self, event): + # Проверяем наличие несохраненных изменений + confirm = self.view.get_confirmation_unsaved_changes( + 'There are unsaved changes. Are you sure you want to quit?') + if not confirm: + # Пользователь отменил закрытие + event.ignore() + return + + # Сохраняем геометрию окна geom = self.saveGeometry() self.view.settings.setValue('MainWindow/geometry', geom) event.accept()