PySide2 QTreeWidget

PySide2 QTreeWidget_第1张图片

# -*- 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("Ctrl+S

你可能感兴趣的:(Maya,PySide2)