mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -98,7 +98,7 @@ class Completer(QListView): # {{{
|
|||||||
self.setAlternatingRowColors(True)
|
self.setAlternatingRowColors(True)
|
||||||
self.setModel(CompleteModel(self, sort_func=sort_func, strip_completion_entries=strip_completion_entries))
|
self.setModel(CompleteModel(self, sort_func=sort_func, strip_completion_entries=strip_completion_entries))
|
||||||
self.setMouseTracking(True)
|
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.activated.connect(self.item_chosen)
|
||||||
self.pressed.connect(self.item_chosen)
|
self.pressed.connect(self.item_chosen)
|
||||||
self.installEventFilter(self)
|
self.installEventFilter(self)
|
||||||
@ -132,7 +132,7 @@ class Completer(QListView): # {{{
|
|||||||
try:
|
try:
|
||||||
self.setCurrentIndex(idx)
|
self.setCurrentIndex(idx)
|
||||||
finally:
|
finally:
|
||||||
self.entered.connect(self.item_entered)
|
self.entered.connect(self.item_entered, type=Qt.QueuedConnection)
|
||||||
|
|
||||||
def next_match(self, previous=False):
|
def next_match(self, previous=False):
|
||||||
c = self.currentIndex()
|
c = self.currentIndex()
|
||||||
@ -525,12 +525,13 @@ class EditWithComplete(EnComboBox):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from PyQt5.Qt import QDialog, QVBoxLayout
|
from PyQt5.Qt import QDialog, QVBoxLayout
|
||||||
app = QApplication([])
|
from calibre.gui2 import Application
|
||||||
|
app = Application([])
|
||||||
d = QDialog()
|
d = QDialog()
|
||||||
d.setLayout(QVBoxLayout())
|
d.setLayout(QVBoxLayout())
|
||||||
le = EditWithComplete(d)
|
le = EditWithComplete(d)
|
||||||
d.layout().addWidget(le)
|
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']
|
'oothree', 'a1', 'a2',u'Edgas', u'Èdgar', u'Édgaq', u'Edgar', u'Édgar']
|
||||||
le.update_items_cache(items)
|
le.update_items_cache(items)
|
||||||
le.show_initial_value('')
|
le.show_initial_value('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user