From 6f9214d5a74f400865fb8871d8254ddc1134fb75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 1 Sep 2017 05:39:11 +0530 Subject: [PATCH] Another mysterious instance of Qt delivering resize events with type set to that of mouse events. Fixes #1714353 [series name change](https://bugs.launchpad.net/calibre/+bug/1714353) --- src/calibre/gui2/complete2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/complete2.py b/src/calibre/gui2/complete2.py index db2858bc1e..d352c5d9d0 100644 --- a/src/calibre/gui2/complete2.py +++ b/src/calibre/gui2/complete2.py @@ -266,7 +266,7 @@ class Completer(QListView): # {{{ # See https://bugreports.qt-project.org/browse/QTBUG-41806 e.accept() return True - elif etype == e.MouseButtonPress and not self.rect().contains(self.mapFromGlobal(e.globalPos())): + elif etype == e.MouseButtonPress and hasattr(e, 'globalPos') and not self.rect().contains(self.mapFromGlobal(e.globalPos())): # A click outside the popup, close it if isinstance(widget, QComboBox): # This workaround is needed to ensure clicking on the drop down @@ -518,6 +518,7 @@ class EditWithComplete(EnComboBox): return True return EnComboBox.eventFilter(self, obj, e) + if __name__ == '__main__': from PyQt5.Qt import QDialog, QVBoxLayout app = QApplication([])