Skip to content

Commit

Permalink
Select all text in Magic Bar when focusing via hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
horazont committed Dec 21, 2017
1 parent b1f3db2 commit 4a02ce4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jabbercat/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def __init__(self, main, parent=None):
)

self.ui.action_focus_search_bar.triggered.connect(
self.ui.magic_bar.setFocus
self._select_magic_bar
)
self.ui.action_focus_search_bar.changed.connect(
self._relabel_magic_bar
Expand Down Expand Up @@ -197,6 +197,10 @@ def _relabel_magic_bar(self):
)
)

def _select_magic_bar(self):
self.ui.magic_bar.selectAll()
self.ui.magic_bar.setFocus()

def eventFilter(self, obj: Qt.QObject, event: Qt.QEvent) -> bool:
if obj is self.ui.magic_bar:
if event.type() == Qt.QEvent.KeyPress:
Expand Down

0 comments on commit 4a02ce4

Please sign in to comment.