mirror of
https://github.com/rbreu/beeref.git
synced 2026-03-11 08:54:28 +00:00
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:
parent
c2ecc42834
commit
cf49e8659e
1 changed files with 9 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue