added keyboard shortcut (ctrl-f) for focusing the search box
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import QWidget, QLineEdit, QPushButton, QHBoxLayout, QStyle
|
from PyQt5.QtGui import QKeySequence
|
||||||
|
from PyQt5.QtWidgets import QWidget, QLineEdit, QPushButton, QHBoxLayout, QStyle, QShortcut
|
||||||
|
|
||||||
|
|
||||||
class SearchBox(QWidget):
|
class SearchBox(QWidget):
|
||||||
@ -26,6 +27,10 @@ class SearchBox(QWidget):
|
|||||||
|
|
||||||
btn.clicked.connect(self.txt.clear)
|
btn.clicked.connect(self.txt.clear)
|
||||||
|
|
||||||
|
#TODO: where should this go? probably top level MainWindow...
|
||||||
|
shortcut = QShortcut(QKeySequence("Ctrl+F"), self)
|
||||||
|
shortcut.activated.connect(txt.setFocus)
|
||||||
|
|
||||||
|
|
||||||
# behave like encapsulated QLineEdit
|
# behave like encapsulated QLineEdit
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
|
Reference in New Issue
Block a user