本文整理匯總了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)