# -*- coding: utf-8 -*-
"""
Author: Administrator
Date: 2020/5/10 14:05
"""
from PySide2 import QtCore, QtGui, QtWidgets
from functools import partial
from shiboken2 import wrapInstance
import maya.OpenMayaUI as omui
import maya.cmds as cmds
import maya.mel as mel
def maya_main_window():
"""
Return the Maya main window widget as a Python object
"""
main_window_ptr = omui.MQtUtil.mainWindow()
return wrapInstance(long(main_window_ptr), QtWidgets.QWidget)
class SimpleOutliner(QtWidgets.QDialog):
WINDOW_TITLE = "Simple Outliner"
dlg_instance = None
def __init__(self, parent=maya_main_window()):
super(SimpleOutliner, self).__init__(parent)
self.setWindowTitle(self.WINDOW_TITLE)
self.setMinimumSize(600, 400)
self.setWindowFlags(self.windowFlags() ^ QtCore.Qt.WindowContextHelpButtonHint)
self.scriptJob_num = -1
self.create_action()
self.create_widgets()
self.create_layout()
self.create_connections()
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.show_context)
def create_action(self):
self.about_action = QtWidgets.QAction("About", self)
self.display_action = QtWidgets.QAction("Shapes", self)
self.display_action.setCheckable(True)
self.display_action.setChecked(True)
self.display_action.setShortcut(QtGui.QKeySequence(
PySide2 QTreeWidget
最新推荐文章于 2024-08-08 20:16:27 发布
本文详细介绍了PySide2库中的QTreeWidget组件,包括如何创建、添加和操作树形结构数据,以及自定义显示和事件处理。通过实例代码,展示了在Python环境下如何实现一个功能完备的树形视图。
摘要由CSDN通过智能技术生成