mirror of
https://github.com/pyqt/examples.git
synced 2025-08-30 21:35:08 +00:00
Bug fix proposal
Suppose you type Lorem, try to exit, get Save as dialogue, close it and app closes on you. I think we should add a check about it (And give the book a fix too :))
This commit is contained in:
@@ -12,6 +12,8 @@ class MainWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
if answer & QMessageBox.Save:
|
if answer & QMessageBox.Save:
|
||||||
save()
|
save()
|
||||||
|
if text.document().isModified():
|
||||||
|
event.ignore()
|
||||||
elif answer & QMessageBox.Cancel:
|
elif answer & QMessageBox.Cancel:
|
||||||
e.ignore()
|
e.ignore()
|
||||||
|
|
||||||
@@ -76,4 +78,4 @@ def show_about_dialog():
|
|||||||
about_action.triggered.connect(show_about_dialog)
|
about_action.triggered.connect(show_about_dialog)
|
||||||
|
|
||||||
window.show()
|
window.show()
|
||||||
app.exec_()
|
app.exec_()
|
||||||
|
Reference in New Issue
Block a user