Allow pressing F2 in the tags field of the edit metadata dialog to launch the tags editor

This commit is contained in:
Kovid Goyal
2020-02-04 18:39:31 +05:30
parent 871a3ec922
commit 4a574c1a0f
2 changed files with 9 additions and 0 deletions
@@ -1360,6 +1360,7 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
'or phrases, separated by commas.')
FIELD_NAME = 'tags'
data_changed = pyqtSignal()
tag_editor_requested = pyqtSignal()
def __init__(self, parent):
EditWithComplete.__init__(self, parent)
@@ -1417,6 +1418,13 @@ class TagsEdit(EditWithComplete, ToMetadataMixin): # {{{
allow_case_change=True)
return True
def keyPressEvent(self, ev):
if ev.key() == Qt.Key_F2:
self.tag_editor_requested.emit()
ev.accept()
return
return EditWithComplete.keyPressEvent(self, ev)
# }}}
+1
View File
@@ -235,6 +235,7 @@ class MetadataSingleDialogBase(QDialog):
self.tags_editor_button.setToolTip(_('Open Tag editor'))
self.tags_editor_button.setIcon(QIcon(I('chapters.png')))
self.tags_editor_button.clicked.connect(self.tags_editor)
self.tags.tag_editor_requested.connect(self.tags_editor)
self.clear_tags_button = QToolButton(self)
self.clear_tags_button.setToolTip(_('Clear all tags'))
self.clear_tags_button.setIcon(QIcon(I('trash.png')))