mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Search box: Fix completer no longer working after using Tag Browser to do a search. Also ensure that completer popup is always hidden when a search is performed.
This commit is contained in:
parent
dcc5ae6137
commit
9b06f9046d
@ -108,6 +108,12 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.colorize = colorize
|
self.colorize = colorize
|
||||||
self.clear()
|
self.clear()
|
||||||
|
|
||||||
|
def hide_completer_popup(self):
|
||||||
|
try:
|
||||||
|
self.lineEdit().completer().popup().setVisible(False)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def normalize_state(self):
|
def normalize_state(self):
|
||||||
self.setToolTip(self.tool_tip_text)
|
self.setToolTip(self.tool_tip_text)
|
||||||
self.line_edit.setStyleSheet(
|
self.line_edit.setStyleSheet(
|
||||||
@ -185,6 +191,7 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.do_search()
|
self.do_search()
|
||||||
|
|
||||||
def _do_search(self, store_in_history=True):
|
def _do_search(self, store_in_history=True):
|
||||||
|
self.hide_completer_popup()
|
||||||
text = unicode(self.currentText()).strip()
|
text = unicode(self.currentText()).strip()
|
||||||
if not text:
|
if not text:
|
||||||
return self.clear()
|
return self.clear()
|
||||||
@ -221,15 +228,11 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.clear()
|
self.clear()
|
||||||
else:
|
else:
|
||||||
self.normalize_state()
|
self.normalize_state()
|
||||||
self.lineEdit().setCompleter(None)
|
|
||||||
self.setEditText(txt)
|
self.setEditText(txt)
|
||||||
self.line_edit.end(False)
|
self.line_edit.end(False)
|
||||||
if emit_changed:
|
if emit_changed:
|
||||||
self.changed.emit()
|
self.changed.emit()
|
||||||
self._do_search(store_in_history=store_in_history)
|
self._do_search(store_in_history=store_in_history)
|
||||||
c = QCompleter()
|
|
||||||
self.lineEdit().setCompleter(c)
|
|
||||||
c.setCompletionMode(c.PopupCompletion)
|
|
||||||
self.focus_to_library.emit()
|
self.focus_to_library.emit()
|
||||||
finally:
|
finally:
|
||||||
if not store_in_history:
|
if not store_in_history:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user