本文整理汇总了Python中qtpy.QtWidgets.QMenu.addSection方法的典型用法代码示例。如果您正苦于以下问题:Python QMenu.addSection方法的具体用法?Python QMenu.addSection怎么用?Python QMenu.addSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QMenu
的用法示例。
在下文中一共展示了QMenu.addSection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize_toolbar
# 需要导入模块: from qtpy.QtWidgets import QMenu [as 别名]
# 或者: from qtpy.QtWidgets.QMenu import addSection [as 别名]
def initialize_toolbar(self):
"""
"""
# Merge the main tool bar and the plot tool bar to get back some
# real estate
self.current_workspace.addToolBar(
self.current_workspace.current_plot_window.tool_bar)
self.current_workspace.main_tool_bar.setIconSize(QSize(15, 15))
# Hide the first five actions in the default specviz tool bar
for act in self.current_workspace.main_tool_bar.actions()[:6]:
act.setVisible(False)
# Hide the tabs of the mdiarea in specviz.
self.current_workspace.mdi_area.setViewMode(QMdiArea.SubWindowView)
self.current_workspace.current_plot_window.setWindowFlags(Qt.FramelessWindowHint)
self.current_workspace.current_plot_window.showMaximized()
if self._layout is not None:
cube_ops = QAction(QIcon(":/icons/cube.svg"), "Cube Operations",
self.current_workspace.main_tool_bar)
self.current_workspace.main_tool_bar.addAction(cube_ops)
self.current_workspace.main_tool_bar.addSeparator()
button = self.current_workspace.main_tool_bar.widgetForAction(cube_ops)
button.setPopupMode(QToolButton.InstantPopup)
menu = QMenu(self.current_workspace.main_tool_bar)
button.setMenu(menu)
# Create operation actions
menu.addSection("2D Operations")
act = QAction("Simple Linemap", self)
act.triggered.connect(lambda: simple_linemap(self))
menu.addAction(act)
act = QAction("Fitted Linemap", self)
act.triggered.connect(lambda: fitted_linemap(self))
menu.addAction(act)
menu.addSection("3D Operations")
act = QAction("Fit Spaxels", self)
act.triggered.connect(lambda: fit_spaxels(self))
menu.addAction(act)
act = QAction("Spectral Smoothing", self)
act.triggered.connect(lambda: spectral_smoothing(self))
menu.addAction(act)