本文整理汇总了Python中PyQt5.Qt.QKeySequence.keyBindings方法的典型用法代码示例。如果您正苦于以下问题:Python QKeySequence.keyBindings方法的具体用法?Python QKeySequence.keyBindings怎么用?Python QKeySequence.keyBindings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QKeySequence
的用法示例。
在下文中一共展示了QKeySequence.keyBindings方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init_search_box_mixin
# 需要导入模块: from PyQt5.Qt import QKeySequence [as 别名]
# 或者: from PyQt5.Qt.QKeySequence import keyBindings [as 别名]
def init_search_box_mixin(self):
self.search.initialize('main_search_history', colorize=True,
help_text=_('Search (For Advanced Search click the button to the left)'))
self.search.cleared.connect(self.search_box_cleared)
# Queued so that search.current_text will be correct
self.search.changed.connect(self.search_box_changed,
type=Qt.QueuedConnection)
self.search.focus_to_library.connect(self.focus_to_library)
self.clear_button.clicked.connect(self.search.clear_clicked)
self.advanced_search_button.clicked[bool].connect(self.do_advanced_search)
self.search.clear()
self.search.setMaximumWidth(self.width()-150)
self.action_focus_search = QAction(self)
shortcuts = list(
map(lambda x:unicode(x.toString(QKeySequence.PortableText)),
QKeySequence.keyBindings(QKeySequence.Find)))
shortcuts += ['/', 'Alt+S']
self.keyboard.register_shortcut('start search', _('Start search'),
default_keys=shortcuts, action=self.action_focus_search)
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())
self.set_highlight_only_button_icon()
self.highlight_only_button.clicked.connect(self.highlight_only_clicked)
tt = _('Enable or disable search highlighting.') + '<br><br>'
tt += config.help('highlight_search_matches')
self.highlight_only_button.setToolTip(tt)
示例2: init_search_box_mixin
# 需要导入模块: from PyQt5.Qt import QKeySequence [as 别名]
# 或者: from PyQt5.Qt.QKeySequence import keyBindings [as 别名]
def init_search_box_mixin(self):
self.search.initialize(
"main_search_history",
colorize=True,
help_text=_("Search (For Advanced Search click the button to the left)"),
)
self.search.cleared.connect(self.search_box_cleared)
# Queued so that search.current_text will be correct
self.search.changed.connect(self.search_box_changed, type=Qt.QueuedConnection)
self.search.focus_to_library.connect(self.focus_to_library)
self.clear_button.clicked.connect(self.search.clear_clicked)
self.advanced_search_button.clicked[bool].connect(self.do_advanced_search)
self.search.clear()
self.search.setMaximumWidth(self.width() - 150)
self.action_focus_search = QAction(self)
shortcuts = list(
map(lambda x: unicode(x.toString(QKeySequence.PortableText)), QKeySequence.keyBindings(QKeySequence.Find))
)
shortcuts += ["/", "Alt+S"]
self.keyboard.register_shortcut(
"start search", _("Start search"), default_keys=shortcuts, action=self.action_focus_search
)
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())
self.set_highlight_only_button_icon()
self.highlight_only_button.clicked.connect(self.highlight_only_clicked)
tt = _("Enable or disable search highlighting.") + "<br><br>"
tt += config.help("highlight_search_matches")
self.highlight_only_button.setToolTip(tt)
self.highlight_only_action = ac = QAction(self)
self.addAction(ac), ac.triggered.connect(self.highlight_only_clicked)
self.keyboard.register_shortcut(
"highlight search results", _("Highlight search results"), action=self.highlight_only_action
)
示例3: access_key
# 需要导入模块: from PyQt5.Qt import QKeySequence [as 别名]
# 或者: from PyQt5.Qt.QKeySequence import keyBindings [as 别名]
def access_key(k):
'Return shortcut text suitable for adding to a menu item'
if QKeySequence.keyBindings(k):
return '\t' + QKeySequence(k).toString(QKeySequence.NativeText)
return ''