当前位置: 首页>>代码示例>>Python>>正文


Python QKeySequence.keyBindings方法代码示例

本文整理汇总了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)
开发者ID:Cykooz,项目名称:calibre,代码行数:33,代码来源:search_box.py

示例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
        )
开发者ID:davidfor,项目名称:calibre,代码行数:40,代码来源:search_box.py

示例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 ''
开发者ID:Aliminator666,项目名称:calibre,代码行数:7,代码来源:widgets2.py


注:本文中的PyQt5.Qt.QKeySequence.keyBindings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。