mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-03 00:56:10 +01:00
Fix a crash in popup completion lists if the mouse is over the list and list is scrolled with the keyboard
Seems to be a regression in newer Qt versions, work around it.
This commit is contained in:
parent
a33fe3f671
commit
f62e3a1bfc
1 changed files with 5 additions and 4 deletions
|
|
@ -98,7 +98,7 @@ def __init__(self, completer_widget, max_visible_items=7, sort_func=sort_key, st
|
|||
self.setAlternatingRowColors(True)
|
||||
self.setModel(CompleteModel(self, sort_func=sort_func, strip_completion_entries=strip_completion_entries))
|
||||
self.setMouseTracking(True)
|
||||
self.entered.connect(self.item_entered)
|
||||
self.entered.connect(self.item_entered, type=Qt.QueuedConnection)
|
||||
self.activated.connect(self.item_chosen)
|
||||
self.pressed.connect(self.item_chosen)
|
||||
self.installEventFilter(self)
|
||||
|
|
@ -132,7 +132,7 @@ def item_entered(self, idx):
|
|||
try:
|
||||
self.setCurrentIndex(idx)
|
||||
finally:
|
||||
self.entered.connect(self.item_entered)
|
||||
self.entered.connect(self.item_entered, type=Qt.QueuedConnection)
|
||||
|
||||
def next_match(self, previous=False):
|
||||
c = self.currentIndex()
|
||||
|
|
@ -525,12 +525,13 @@ def eventFilter(self, obj, e):
|
|||
|
||||
if __name__ == '__main__':
|
||||
from PyQt5.Qt import QDialog, QVBoxLayout
|
||||
app = QApplication([])
|
||||
from calibre.gui2 import Application
|
||||
app = Application([])
|
||||
d = QDialog()
|
||||
d.setLayout(QVBoxLayout())
|
||||
le = EditWithComplete(d)
|
||||
d.layout().addWidget(le)
|
||||
items = ['one', 'otwo', 'othree', 'ooone', 'ootwo',
|
||||
items = ['one', 'otwo', 'othree', 'ooone', 'ootwo', 'other', 'odd', 'over', 'orc', 'oven', 'owe',
|
||||
'oothree', 'a1', 'a2',u'Edgas', u'Èdgar', u'Édgaq', u'Edgar', u'Édgar']
|
||||
le.update_items_cache(items)
|
||||
le.show_initial_value('')
|
||||
|
|
|
|||
Loading…
Reference in a new issue