本文整理汇总了Python中PyQt4.QtGui.QMenu.setTearOffEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QMenu.setTearOffEnabled方法的具体用法?Python QMenu.setTearOffEnabled怎么用?Python QMenu.setTearOffEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QMenu
的用法示例。
在下文中一共展示了QMenu.setTearOffEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MSMainWindow
# 需要导入模块: from PyQt4.QtGui import QMenu [as 别名]
# 或者: from PyQt4.QtGui.QMenu import setTearOffEnabled [as 别名]
class MSMainWindow(QMainWindow):
"""Gui of the main window"""
# MAX_RECENT_FILES = 10
# start putting links spyder numpy scipy et tutti quanti
links = (
"http://numpy.scipy.org/",
"http://packages.python.org/spyder/",
"http://www.riverbankcomputing.co.uk/software/pyqt/intro",
)
pluginPath = path.normcase("pluginmanager/plugins/")
def __init__(self, availablePlugins):
"""
Constructor with all the models needed setup menus
"""
QMainWindow.__init__(self)
self.setDockOptions(QMainWindow.VerticalTabs | QMainWindow.AnimatedDocks)
self.plugins = availablePlugins
self.pluginsInst = []
settings = QSettings(
"INRA/INSA", "-".join([QApplication.instance().APPLICATION_NAME_STR, QApplication.instance().VERSION_STR])
)
self.recentFiles = list(settings.value("RecentFiles").toStringList())
self.setStyleSheet(stylesheet)
self.pipeline = MSPipelineToolBar("Pipeline toolbar", parent=self)
self.addToolBar(0x1, self.pipeline)
self._setupModels()
self._setupUi()
self._setupMenus()
def _setupModels(self):
"""
Warning:Causes segfault when horizontal labels set to True
on aura peu etre a la fin un model par sampleList c'est ce qui parait
le plus logique
"""
# drag and drop table sample
self.sampleModel = QStandardItemModel(self)
self.sampleModel.setHorizontalHeaderLabels(["Sample", "Class"])
# treeView1
self.spectraModel = QStandardItemModel(self)
# treeview2
self.peakModel = QStandardItemModel(self)
# treeview3
self.clusterModel = QStandardItemModel(self)
def _setupMenus(self):
# file
self.fileMenu = QMenu("&File")
self.fileMenu.setTearOffEnabled(True)
self.op = QMenu("&Open...", self.fileMenu)
self.op.setIcon(QIcon(path.normcase("gui/icons/fileopen.png")))
open_ = QAction("&Open rawfiles", self)
open_.setToolTip("Open an mzXML or netCDF file")
open_.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_O))
open_icon = QIcon(path.normcase("gui/icons/fileopen.png"))
open_.setIcon(open_icon)
self.op.addAction(open_)
load_ = QAction("&Open projects...", self)
load_.setToolTip("load binary file containing saved objects")
load_.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S))
load_icon = QIcon(QPixmap(path.normcase("gui/icons/project_open.png")))
load_.setIcon(load_icon)
self.op.addAction(load_)
self.fileMenu.addMenu(self.op)
save_ = QAction("&Save...", self)
save_.setToolTip("save the actual application model")
save_.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S))
save_icon = QIcon(path.normcase("gui/icons/save_all.png"))
save_.setIcon(save_icon)
self.fileMenu.addAction(save_)
pkl = QAction("&load a peaklist", self) # TODO:load peaklist
pkl.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_P))
pkl.setToolTip("load a peaklist and process it")
pkl.setIcon(QIcon(path.normcase("gui/icons/featuredetect.png")))
self.fileMenu.addAction(pkl)
convert_ = QAction("&Convert...", self)
convert_.setEnabled(False)
convert_.setToolTip("Convert a .wiff file if Analyst(c) is installed")
convert_icon = QIcon(path.normcase("gui/icons/goto.png"))
convert_.setIcon(convert_icon)
self.fileMenu.addAction(convert_)
a = self.fileMenu.addAction(QIcon(path.normcase("gui/icons/process.png")), "&Launch a batch")
a.setEnabled(False)
b = self.fileMenu.addAction(QIcon(path.normcase("gui/icons/process.png")), "&Merge")
b.setToolTip("Merge MRM file")
#.........这里部分代码省略.........