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
then I "translate" Pyqt to maya to be able to assign the layout with any extra code
Transform a Maya widget to a QWidget
And Finally add the Widget to my Layout
Switching to answer format:
The current code would be better if you were not dependent on the hard coded names:
that way the real names of the controls will be used and you're less vulnerable to strays with the same name. It's still good practice to delete strays - but it's hard to be sure without making the code very cumbersome.
Also, the line:
looks redundant - is it intentional? Is it a lefttover of an attempt to parent the outline? because the p= keyword ought to be doing your parenting for you.
Lurker update
As OP pointed out, code above wont' work - i've updated the sample to indicate the problem for the benefit of future readers.