当前位置: 首页>>代码示例>>Python>>正文


Python QMenu.addSection方法代码示例

本文整理汇总了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)
开发者ID:nmearl,项目名称:specviz,代码行数:52,代码来源:viewer.py


注:本文中的qtpy.QtWidgets.QMenu.addSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。