mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-03 13:53:02 +02:00
Search box: Remove select all on focus event as focus events are fired when completion fails/succeeds. Instead select all only when search box is focussed via the keyboard shortcut
This commit is contained in:
parent
983da07095
commit
ba831d21e3
1 changed files with 5 additions and 6 deletions
|
|
@ -28,10 +28,6 @@ def mouseReleaseEvent(self, event):
|
|||
QLineEdit.mouseReleaseEvent(self, event)
|
||||
QLineEdit.selectAll(self)
|
||||
|
||||
def focusInEvent(self, event):
|
||||
QLineEdit.focusInEvent(self, event)
|
||||
QLineEdit.selectAll(self)
|
||||
|
||||
def dropEvent(self, ev):
|
||||
self.parent().normalize_state()
|
||||
return QLineEdit.dropEvent(self, ev)
|
||||
|
|
@ -334,14 +330,17 @@ def __init__(self):
|
|||
shortcuts = QKeySequence.keyBindings(QKeySequence.Find)
|
||||
shortcuts = list(shortcuts) + [QKeySequence('/'), QKeySequence('Alt+S')]
|
||||
self.action_focus_search.setShortcuts(shortcuts)
|
||||
self.action_focus_search.triggered.connect(lambda x:
|
||||
self.search.setFocus(Qt.OtherFocusReason))
|
||||
self.action_focus_search.triggered.connect(self.focus_search_box)
|
||||
self.addAction(self.action_focus_search)
|
||||
self.search.setStatusTip(re.sub(r'<\w+>', ' ',
|
||||
unicode(self.search.toolTip())))
|
||||
self.advanced_search_button.setStatusTip(self.advanced_search_button.toolTip())
|
||||
self.clear_button.setStatusTip(self.clear_button.toolTip())
|
||||
|
||||
def focus_search_box(self, *args):
|
||||
self.search.setFocus(Qt.OtherFocusReason)
|
||||
self.search.lineEdit().selectAll()
|
||||
|
||||
def search_box_cleared(self):
|
||||
self.tags_view.clear()
|
||||
self.saved_search.clear()
|
||||
|
|
|
|||
Loading…
Reference in a new issue