本文整理汇总了Python中PyQt5.Qt.QShortcut.setContext方法的典型用法代码示例。如果您正苦于以下问题:Python QShortcut.setContext方法的具体用法?Python QShortcut.setContext怎么用?Python QShortcut.setContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QShortcut
的用法示例。
在下文中一共展示了QShortcut.setContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PyQt5.Qt import QShortcut [as 别名]
# 或者: from PyQt5.Qt.QShortcut import setContext [as 别名]
#.........这里部分代码省略.........
self.Inspector.add_property()
#--------------------------------------------------------------------------------
def remove_user_property(self):
#self.Inspector.save_cmps()
self.FieldInspector.save_fields()
self.Inspector.remove_property()
#--------------------------------------------------------------------------------
def rename_user_property(self):
#self.Inspector.save_cmps()
self.FieldInspector.save_fields()
self.Inspector.rename_property()
#--------------------------------------------------------------------------------
def __init__(self):
super().__init__()
self.initUI()
self.installEventFilter(self.EventFilter(self))
self.setFocusPolicy(Qt.WheelFocus)
self.setTabOrder(self.CmpTable, self.Inspector )
self.setTabOrder(self.Inspector, self.Selector)
self.setTabOrder(self.Selector, self.FieldInspector)
#self.setTabOrder(self.FieldInspector, self.CmpTable)
#----------------------------------------------------
#
# Application Hotkeys
#
self.shortcutLeft = QShortcut(QKeySequence(Qt.ALT + Qt.Key_Left), self)
self.shortcutRight = QShortcut(QKeySequence(Qt.ALT + Qt.Key_Right), self)
self.shortcutLeft.setContext(Qt.ApplicationShortcut)
self.shortcutRight.setContext(Qt.ApplicationShortcut)
self.shortcutLeft.activated.connect(self.scroll_left)
self.shortcutRight.activated.connect(self.scroll_right)
#--------------------------------------------------------------------------------
def initUI(self):
#----------------------------------------------------
#
# Main Window
#
work_zone = QWidget(self)
Layout = QHBoxLayout(work_zone)
self.setCentralWidget(work_zone)
openAction = QAction(QIcon( os.path.join(resources_path, 'open24.png') ), 'Open', self)
openAction.setShortcut('Ctrl+O')
openAction.setStatusTip('Open Schematic File')
openAction.triggered.connect(self.open_file)
saveAction = QAction(QIcon( os.path.join(resources_path, 'save24.png') ), 'Save', self)
saveAction.setShortcut('Ctrl+S')
saveAction.setStatusTip('Save Schematic File')
saveAction.triggered.connect(self.save_file)
saveAsAction = QAction(QIcon( os.path.join(resources_path, 'save-as24.png') ), 'Save As...', self)
saveAsAction.setShortcut('Ctrl+Shift+S')
saveAsAction.setStatusTip('Save Schematic File As...')
saveAsAction.triggered.connect(self.save_file_as)
exitAction = QAction(QIcon( os.path.join(resources_path, 'exit24.png') ), 'Exit', self)