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.
This commit is contained in:
DS_Litvinov 2025-11-20 16:25:49 +03:00
parent c2ecc42834
commit cf49e8659e

View file

@ -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()