mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Merge pull request #803 from RumovZ/fix-completer-focus
Work around Qt's focus bug (fix help-wanted#22)
This commit is contained in:
commit
6b0b3fcd6a
3 changed files with 14 additions and 0 deletions
|
@ -65,6 +65,7 @@ lukkea <github.com/lukkea/>
|
||||||
David Allison <davidallisongithub@gmail.com>
|
David Allison <davidallisongithub@gmail.com>
|
||||||
Tsung-Han Yu <johan456789@gmail.com>
|
Tsung-Han Yu <johan456789@gmail.com>
|
||||||
Piotr Kubowicz <piotr.kubowicz@gmail.com>
|
Piotr Kubowicz <piotr.kubowicz@gmail.com>
|
||||||
|
RumovZ <gp5glkw78@relay.firefox.com>
|
||||||
|
|
||||||
********************
|
********************
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,10 @@ class AddCards(QDialog):
|
||||||
self.editor.saveAddModeVars()
|
self.editor.saveAddModeVars()
|
||||||
if not self.addNote(self.editor.note):
|
if not self.addNote(self.editor.note):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# workaround for PyQt focus bug
|
||||||
|
self.editor.hideCompleters()
|
||||||
|
|
||||||
tooltip(_("Added"), period=500)
|
tooltip(_("Added"), period=500)
|
||||||
av_player.stop_and_clear_queue()
|
av_player.stop_and_clear_queue()
|
||||||
self.onReset(keep=True)
|
self.onReset(keep=True)
|
||||||
|
|
|
@ -1061,6 +1061,9 @@ QTableView {{ gridline-color: {grid} }}
|
||||||
self.maybeRefreshSidebar()
|
self.maybeRefreshSidebar()
|
||||||
|
|
||||||
def focusSidebar(self) -> None:
|
def focusSidebar(self) -> None:
|
||||||
|
# workaround for PyQt focus bug
|
||||||
|
self.editor.hideCompleters()
|
||||||
|
|
||||||
self.sidebarDockWidget.setVisible(True)
|
self.sidebarDockWidget.setVisible(True)
|
||||||
self.sidebarTree.setFocus()
|
self.sidebarTree.setFocus()
|
||||||
|
|
||||||
|
@ -2072,10 +2075,16 @@ where id in %s"""
|
||||||
sm.select(item, QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows)
|
sm.select(item, QItemSelectionModel.SelectCurrent | QItemSelectionModel.Rows)
|
||||||
|
|
||||||
def onFind(self):
|
def onFind(self):
|
||||||
|
# workaround for PyQt focus bug
|
||||||
|
self.editor.hideCompleters()
|
||||||
|
|
||||||
self.form.searchEdit.setFocus()
|
self.form.searchEdit.setFocus()
|
||||||
self.form.searchEdit.lineEdit().selectAll()
|
self.form.searchEdit.lineEdit().selectAll()
|
||||||
|
|
||||||
def onNote(self):
|
def onNote(self):
|
||||||
|
# workaround for PyQt focus bug
|
||||||
|
self.editor.hideCompleters()
|
||||||
|
|
||||||
self.editor.web.setFocus()
|
self.editor.web.setFocus()
|
||||||
self.editor.loadNote(focusTo=0)
|
self.editor.loadNote(focusTo=0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue