mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix a regression that caused clicking the clear button in the main search bar to not unapply the current search until enter is pressed.
Fixes #1729819 [removing search from tool bar does not bring you back to authors and current books or main screen](https://bugs.launchpad.net/calibre/+bug/1729819)
This commit is contained in:
parent
32566d7c79
commit
24ab86f277
@ -21,6 +21,8 @@ from calibre.gui2.dialogs.saved_search_editor import SavedSearchEditor
|
|||||||
from calibre.gui2.dialogs.search import SearchDialog
|
from calibre.gui2.dialogs.search import SearchDialog
|
||||||
from calibre.utils.icu import primary_sort_key
|
from calibre.utils.icu import primary_sort_key
|
||||||
|
|
||||||
|
QT_HIDDEN_CLEAR_ACTION = '_q_qlineeditclearaction'
|
||||||
|
|
||||||
|
|
||||||
class AsYouType(unicode):
|
class AsYouType(unicode):
|
||||||
|
|
||||||
@ -110,6 +112,9 @@ class SearchBox2(QComboBox): # {{{
|
|||||||
self.setLineEdit(self.line_edit)
|
self.setLineEdit(self.line_edit)
|
||||||
if add_clear_action:
|
if add_clear_action:
|
||||||
self.lineEdit().setClearButtonEnabled(True)
|
self.lineEdit().setClearButtonEnabled(True)
|
||||||
|
ac = self.findChild(QAction, QT_HIDDEN_CLEAR_ACTION)
|
||||||
|
if ac is not None:
|
||||||
|
ac.triggered.connect(self.clear_clicked)
|
||||||
|
|
||||||
c = self.line_edit.completer()
|
c = self.line_edit.completer()
|
||||||
c.setCompletionMode(c.PopupCompletion)
|
c.setCompletionMode(c.PopupCompletion)
|
||||||
@ -536,7 +541,7 @@ class SavedSearchBoxMixin(object): # {{{
|
|||||||
|
|
||||||
def init_saved_seach_box_mixin(self):
|
def init_saved_seach_box_mixin(self):
|
||||||
self.saved_search.changed.connect(self.saved_searches_changed)
|
self.saved_search.changed.connect(self.saved_searches_changed)
|
||||||
ac = self.findChild(QAction, '_q_qlineeditclearaction')
|
ac = self.search.findChild(QAction, QT_HIDDEN_CLEAR_ACTION)
|
||||||
if ac is not None:
|
if ac is not None:
|
||||||
ac.triggered.connect(self.saved_search.clear)
|
ac.triggered.connect(self.saved_search.clear)
|
||||||
self.save_search_button.clicked.connect(
|
self.save_search_button.clicked.connect(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user