mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
OS X: Workaround for regression in Qt 5 that causes pressing the Esc key to close the entire window instead of the current completion popup
See https://bugreports.qt-project.org/browse/QTBUG-41806
This commit is contained in:
parent
59fc8e518a
commit
2f300b1ae8
@ -244,6 +244,12 @@ class Completer(QListView): # {{{
|
|||||||
self.hide()
|
self.hide()
|
||||||
if e.isAccepted():
|
if e.isAccepted():
|
||||||
return True
|
return True
|
||||||
|
elif isosx and etype == e.InputMethodQuery and e.queries() == (Qt.ImHints | Qt.ImEnabled) and self.isVisible():
|
||||||
|
# In Qt 5 the Esc key cause this event and the line edit does not
|
||||||
|
# handle it, which causes the parent dialog to be closed
|
||||||
|
# See https://bugreports.qt-project.org/browse/QTBUG-41806
|
||||||
|
self.hide(), e.accept()
|
||||||
|
return True
|
||||||
elif etype == e.MouseButtonPress:
|
elif etype == e.MouseButtonPress:
|
||||||
if not self.rect().contains(self.mapFromGlobal(e.globalPos())):
|
if not self.rect().contains(self.mapFromGlobal(e.globalPos())):
|
||||||
QTimer.singleShot(0, self.hide)
|
QTimer.singleShot(0, self.hide)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user