mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for Qt 5 bug that causes the incorrect item to be selected when pressing the Enter key in the completion popup for search boxes.
https://bugreports.qt-project.org/browse/QTBUG-40807
This commit is contained in:
parent
a59f657a69
commit
2a744a4cf9
@ -85,10 +85,10 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
c = self.line_edit.completer()
|
c = self.line_edit.completer()
|
||||||
c.setCompletionMode(c.PopupCompletion)
|
c.setCompletionMode(c.PopupCompletion)
|
||||||
c.highlighted[str].connect(self.completer_used)
|
c.highlighted[str].connect(self.completer_used)
|
||||||
c.activated[str].connect(self.history_selected)
|
|
||||||
|
|
||||||
self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.DirectConnection)
|
self.line_edit.key_pressed.connect(self.key_pressed, type=Qt.DirectConnection)
|
||||||
self.activated[str].connect(self.history_selected)
|
# QueuedConnection as workaround for https://bugreports.qt-project.org/browse/QTBUG-40807
|
||||||
|
self.activated[str].connect(self.history_selected, type=Qt.QueuedConnection)
|
||||||
self.setEditable(True)
|
self.setEditable(True)
|
||||||
self.as_you_type = True
|
self.as_you_type = True
|
||||||
self.timer = QTimer()
|
self.timer = QTimer()
|
||||||
@ -245,7 +245,8 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.focus_to_library.emit()
|
self.focus_to_library.emit()
|
||||||
finally:
|
finally:
|
||||||
if not store_in_history:
|
if not store_in_history:
|
||||||
self.activated[str].connect(self.history_selected)
|
# QueuedConnection as workaround for https://bugreports.qt-project.org/browse/QTBUG-40807
|
||||||
|
self.activated[str].connect(self.history_selected, type=Qt.QueuedConnection)
|
||||||
|
|
||||||
def search_as_you_type(self, enabled):
|
def search_as_you_type(self, enabled):
|
||||||
self.as_you_type = enabled
|
self.as_you_type = enabled
|
||||||
|
Loading…
x
Reference in New Issue
Block a user