Hi all,
I used most of the time the “MayaQWidgetDockableMixin” class along with QtWidgets.QDialog to have a dockable dialog widget. But this one comes with a tab when docked.
class MainDialog(MayaQWidgetDockableMixin, QtWidgets.QDialog):
def __init__(self, parent=MayaWindow()):
super(MainDialog, self).__init__(parent)
# Stuff
ui = MainDialog()
ui.show(dockable=True)
It gives the outliner kinda dialog (on the right), but I’m looking for the Toolbox style(on the left).
Do you guys know the name of that class ?
Thanks
Can’t find anything on google or in the doc… anyone ?
That’s just a regular old QToolBar
You are probably right, but when I instantiate it it’s not dockable, and if add the class mayaQWidgetDockableMixin with show(dockable=True) it shows the tab.
Do you have an example on how to properly set it up ?
Thanks
You just instantiate it as a child of the main window.
I did this, and it showed up already docked in the upper left corner.
from PySide2 import QtWidgets
mainWin = MayaWindow()
tb = QtWidgets.QToolBar(mainWin)
tb.show()
Separate note: I’m pretty sure it’s bad practice to default parent=MayaWindow()
. I can’t actually come up with a way that it breaks anything … but it just feels so very wrong to me.
1 Like
Mmmm yeah, but when undocked, it can’t be docked back. On top of not being a dialog. That toolbar is a mystery to me…
About the parenting to maya windows, I never saw any other way to parent a widget to … the maya windows 
I digged a bit in MayaQWidgetDockableMixin and when an object is set to dockable (as in object.show(dockable=True)) that object becomes a QStackedWidget that itself is child of QTabWidget. That operation is achieved by addWidgetToMayaLayout from OpenMayaUI when set to dockable.
So… I don’t think there is such a thing as non stackable MayaQWidgetDockableMixin object. I’ll have to make my own I guess.