本文整理汇总了Python中PyQt4.QtGui.QShortcut.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QShortcut.setEnabled方法的具体用法?Python QShortcut.setEnabled怎么用?Python QShortcut.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QShortcut
的用法示例。
在下文中一共展示了QShortcut.setEnabled方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _shortcutHelper
# 需要导入模块: from PyQt4.QtGui import QShortcut [as 别名]
# 或者: from PyQt4.QtGui.QShortcut import setEnabled [as 别名]
def _shortcutHelper(self, keySequence, group, description, parent, function, context = None, enabled = None):
shortcut = QShortcut(QKeySequence(keySequence), parent, member=function, ambiguousMember=function)
if context != None:
shortcut.setContext(context)
if enabled != None:
shortcut.setEnabled(True)
return shortcut, group, description
示例2: define_global_shortcuts
# 需要导入模块: from PyQt4.QtGui import QShortcut [as 别名]
# 或者: from PyQt4.QtGui.QShortcut import setEnabled [as 别名]
def define_global_shortcuts(self):
sequence = {
'Ctrl+Shift+Left': self.view_container.prev_chapter,
'Ctrl+Left': self.view_container.first_page,
'Left': self.view_container.page_up,
'Right': self.view_container.page_down,
'Space': self.view_container.page_down,
'Ctrl+Right': self.view_container.last_page,
'Ctrl+Shift+Right': self.view_container.next_chapter,
'Ctrl+R': self.view_container.rotate_right,
'Ctrl+Shift+R': self.view_container.rotate_left,
'Ctrl+B': self.view_container.first_page,
'Ctrl+E': self.view_container.last_page,
'S': self.switch_double_page_direction,
'D': self.switch_double_page,
'M': self.switch_viewing_modes,
'1': self.view_container.original_fit,
'2': self.view_container.vertical_fit,
'3': self.view_container.horizontal_fit,
'4': self.view_container.best_fit,
'Q': self.close,
}
for key, value in sequence.items():
s = QShortcut(QKeySequence(key), self.view_container, value)
s.setEnabled(True)
self.global_shortcuts.append(s)