Well I'm trying to use a outliner in maya with Pyqt4 and python, My outliner is in a Qsplitter with other two panels, it seems the code is ok, but when I run the code sometimes the Outliner appears, sometimes doesn't appear
this is the code where I create the Outliner:
self.outliner = QWidget()
self.outliner.setObjectName("outliner")
self.outLayout = QGridLayout()
self.outLayout.setContentsMargins(0, 0, 0, 0)
self.outLayout.setObjectName("outLayout")
self.outliner.setLayout(self.outLayout)
outL = cmds.outlinerPanel(mbv=False, p="outLayout")
cmds.control(out, edit=True, visible=True, parent="outLayout")
And this is how I display it:
self.splitter1 = QSplitter()
self.splitter1.addWidget(self.list)
self.splitter1.addWidget(self.outliner)
What I need to modify to make it work every time
EDIT:
I Upgraded my code, deleting inecesaring lines, but still doesn't work the way i need
well this is what i finished doing:
The first part is the same
self.outliner = QWidget()
self.outliner.setObjectName("outliner")
self.outLayout = QGridLayout()
self.outLayout.setContentsMargins(0, 0, 0, 0)
self.outLayout.setObjectName("outLayout")
self.outliner.setLayout(self.outLayout)
then I "translate" Pyqt to maya to be able to assign the layout with any extra code
panel = mui.MQtUtil.fullName(long(sip.unwrapinstance(self.outLayout)))
cmds.setParent(panel)
if cmds.modelPanel("outL", exists=True):
cmds.deleteUI("outL")
outL = cmds.outlinerPanel(mbv=False)
cmds.control(outL, edit=True, visible=True, p=panel)
ptr = mui.MQtUtil.findControl(outL)
Transform a Maya widget to a QWidget
self.outPanel = sip.wrapinstance(long(ptr), QObject)
And Finally add the Widget to my Layout
self.outLayout.addWidget(self.outPanel)