Workaround for bug in Qt 5.4 that causes multiple close events to be delivered when using a keyboard shortcut to quit on OS X. Fixes #1440444 [ebook-viewer forgets state of ToC if closed by keyboard (Cmd-Q)](https://bugs.launchpad.net/calibre/+bug/1440444)

This commit is contained in:
Kovid Goyal 2015-04-05 08:29:56 +05:30
parent 147d11f1ea
commit 0a252c6692

View File

@ -80,6 +80,7 @@ class EbookViewer(MainWindow):
start_in_fullscreen=False):
MainWindow.__init__(self, debug_javascript)
self.view.magnification_changed.connect(self.magnification_changed)
self.closed = False
self.show_toc_on_open = False
self.current_book_has_toc = False
self.iterator = None
@ -252,7 +253,11 @@ class EbookViewer(MainWindow):
QApplication.instance().quit()
def closeEvent(self, e):
if self.closed:
e.ignore()
return
if self.shutdown():
self.closed = True
return MainWindow.closeEvent(self, e)
else:
e.ignore()