本文整理汇总了Python中PySide.QtGui.QAction.setShortcuts方法的典型用法代码示例。如果您正苦于以下问题:Python QAction.setShortcuts方法的具体用法?Python QAction.setShortcuts怎么用?Python QAction.setShortcuts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QAction
的用法示例。
在下文中一共展示了QAction.setShortcuts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _makeMenu
# 需要导入模块: from PySide.QtGui import QAction [as 别名]
# 或者: from PySide.QtGui.QAction import setShortcuts [as 别名]
def _makeMenu(self):
'''Makes the menu bar for this widget'''
# Get the menu bar object
self.menu = self.menuBar()
self.fileMenu = self.menu.addMenu('&File')
# Open action
open = QAction('&Open', self)
open.setShortcuts(QKeySequence.Open)
open.triggered.connect(self.openFromInput)
open.setToolTip('Open an already made input file')
self.fileMenu.addAction(open)
# Save action
save = QAction('&Save', self)
save.setShortcuts(QKeySequence.Save)
save.triggered.connect(self.saveToInput)
save.setToolTip('Save settings to an input file')
self.fileMenu.addAction(save)
# Save action
saveas = QAction('Save As', self)
saveas.triggered.connect(self.saveToInputAs)
save.setToolTip('Save settings to an input file of a new name')
self.fileMenu.addAction(saveas)
# Save action
savepdf = QAction('Save as PDF', self)
savepdf.triggered.connect(self.saveAsPDF)
save.setToolTip('Save image to a PDF')
self.fileMenu.addAction(savepdf)
# Menu separator
self.fileMenu.addSeparator()
# Import action
imp = QAction('&Import raw XY data', self)
imp.setShortcut(QKeySequence('Ctrl+I'))
imp.triggered.connect(self.importRawData)
imp.setToolTip('Import raw data an plot alongside calculated data')
self.fileMenu.addAction(imp)
# Export action
raw = QAction('Export raw XY data', self)
raw.triggered.connect(self.exportRawData)
raw.setToolTip('Export raw data to a file for use elsewhere')
self.fileMenu.addAction(raw)
# Export action
exp = QAction('&Export calculated XY data', self)
exp.setShortcut(QKeySequence('Ctrl+E'))
exp.triggered.connect(self.exportXYData)
exp.setToolTip('Export calculated data to a file for use elsewhere')
self.fileMenu.addAction(exp)
# Make script action
scr = QAction('Make Sc&ript', self)
scr.setShortcut(QKeySequence('Ctrl+R'))
scr.triggered.connect(self.makeScript)
scr.setToolTip('Create a python script that directly recreates this '
'spectrum')
self.fileMenu.addAction(scr)
# Menu separator
self.fileMenu.addSeparator()
# Quit action
quit = QAction('&Quit', self)
quit.setShortcuts(QKeySequence.Quit)
quit.triggered.connect(QApplication.instance().quit)
self.fileMenu.addAction(quit)