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


Python Qt.ActionsContextMenu方法代码示例

本文整理汇总了Python中PyQt5.QtCore.Qt.ActionsContextMenu方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.ActionsContextMenu方法的具体用法?Python Qt.ActionsContextMenu怎么用?Python Qt.ActionsContextMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.Qt的用法示例。


在下文中一共展示了Qt.ActionsContextMenu方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ActionsContextMenu [as 别名]
def  __init__(self,parent):
        
        super(CQObjectInspector,self).__init__(parent)
        self.setHeaderHidden(False)
        self.setRootIsDecorated(True)
        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.setColumnCount(2)
        self.setHeaderLabels(['Type','Value'])
        
        self.root = self.invisibleRootItem()
        self.inspected_items = []
        
        self._toolbar_actions = \
            [QAction(icon('inspect'),'Inspect CQ object',self,\
                     toggled=self.inspect,checkable=True)]
        
        self.addActions(self._toolbar_actions) 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:19,代码来源:cq_object_inspector.py

示例2: _init_menu

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ActionsContextMenu [as 别名]
def _init_menu(self):
        self.addAction(QtWidgets.QAction('About PKMeter', self, triggered=self.pkmeter.about.show))
        self.addAction(QtWidgets.QAction('Preferences', self, triggered=self.pkmeter.config.show))
        self.addAction(QtWidgets.QAction('Quit', self, triggered=self.pkmeter.quit))
        self.setContextMenuPolicy(Qt.ActionsContextMenu) 
开发者ID:pkkid,项目名称:pkmeter,代码行数:7,代码来源:pkwidgets.py

示例3: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ActionsContextMenu [as 别名]
def  __init__(self,parent):
        
        super(TracebackTree,self).__init__(parent)   
        self.setHeaderHidden(False)
        self.setItemsExpandable(False)
        self.setRootIsDecorated(False)
        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        
        self.setColumnCount(3)
        self.setHeaderLabels(['File','Line','Code'])
        
        
        self.root = self.invisibleRootItem() 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:15,代码来源:traceback_viewer.py

示例4: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ActionsContextMenu [as 别名]
def __init__(self, parent=None):
        super(TableView, self).__init__(parent)
        self.resize(800, 600)
        self.setContextMenuPolicy(Qt.ActionsContextMenu)  # 右键菜单
        self.setEditTriggers(self.NoEditTriggers)  # 禁止编辑
        self.doubleClicked.connect(self.onDoubleClick)
        self.addAction(QAction("复制", self, triggered=self.copyData))
        self.myModel = QStandardItemModel()  # model
        self.initHeader()  # 初始化表头
        self.setModel(self.myModel)
        self.initData()  # 初始化模拟数据 
开发者ID:PyQt5,项目名称:PyQt,代码行数:13,代码来源:CopyContent.py

示例5: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ActionsContextMenu [as 别名]
def __init__(self, parent=None):
        super(MyButton, self).__init__(parent)
        self.state = None
        self.fname = None
        self.name = None
        # 设置字体
        font = QFont()
        font.setFamily("微软雅黑")
        font.setPointSize(12)
        self.setFont(font)
        # 支持右键菜单
        self.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.initUi() 
开发者ID:xflywind,项目名称:Python-Application,代码行数:15,代码来源:mybutton.py

示例6: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ActionsContextMenu [as 别名]
def  __init__(self,parent):

        super(ObjectTree,self).__init__(parent)

        self.tree = tree = QTreeWidget(self,
                                       selectionMode=QAbstractItemView.ExtendedSelection)
        self.properties_editor = ParameterTree(self)

        tree.setHeaderHidden(True)
        tree.setItemsExpandable(False)
        tree.setRootIsDecorated(False)
        tree.setContextMenuPolicy(Qt.ActionsContextMenu)

        #forward itemChanged singal
        tree.itemChanged.connect(\
            lambda item,col: self.sigItemChanged.emit(item,col))
        #handle visibility changes form tree
        tree.itemChanged.connect(self.handleChecked)

        self.CQ = CQRootItem()
        self.Imports = ImportRootItem()
        self.Helpers = HelpersRootItem()

        root = tree.invisibleRootItem()
        root.addChild(self.CQ)
        root.addChild(self.Imports)
        root.addChild(self.Helpers)
        
        tree.expandToDepth(1)

        self._export_STL_action = \
            QAction('Export as STL',
                    self,
                    enabled=False,
                    triggered=lambda: \
                        self.export('stl',
                                    self.preferences['STL precision']))

        self._export_STEP_action = \
            QAction('Export as STEP',
                    self,
                    enabled=False,
                    triggered=lambda: \
                        self.export('step'))

        self._clear_current_action = QAction(icon('delete'),
                                             'Clear current',
                                             self,
                                             enabled=False,
                                             triggered=self.removeSelected)

        self._toolbar_actions = \
            [QAction(icon('delete-many'),'Clear all',self,triggered=self.removeObjects),
             self._clear_current_action,]

        self.prepareMenu()

        tree.itemSelectionChanged.connect(self.handleSelection)
        tree.customContextMenuRequested.connect(self.showMenu)

        self.prepareLayout() 
开发者ID:CadQuery,项目名称:CQ-editor,代码行数:63,代码来源:object_tree.py


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