On Sat, Dec 22, 2018, 1:16 PM kiteh <[email protected]> wrote:

> Hi Marcus, my bad on this. `hlay` actually refers to the `HBoxLayout()`
>
> I have updated the snippet - https://pastebin.com/raw/EYcMh5hq
>


This part from your snippet isn't correct, for multiple reasons:

self.setTabButton(
    0,
    QtGui.QTabBar.ButtonPosition.RightSide,
    self.add_button
)
hlay = QtGui.QHBoxLayout()
hlay.addWidget(self.add_button)
hlay.addWidget(self)

As documented, setTabButton will take ownership of the button. But then you
add it to a layout. Just create it without a parent and pass it
to setTabButton.

Also, the new layout is created but not attached to to manage any widget.
You add the button and then self and then the layout does nothing.

Just get rid of the layout, is my best guess.


> When trying out your method where:
>
> class MyTabBar(QtGui.QTabBar):
>     def __init__(self, parent=None):
>         super(MyTabBar, self).__init__(parent)
>         ...
>         ...
>         hlay = QtGui.QHBoxLayout(self)
>         hlay.addWidget(self.add_button)
>
>         ...
>         # Or added in the following
>         self.setLayout(self)
>
> While it does not seems to error out but the 'add' icon is gone, and I am
> presented with nothing..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/1e49a218-9a06-437e-b2bb-ee971e59a913%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/1e49a218-9a06-437e-b2bb-ee971e59a913%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2L3Sm%3DfeE55jNC2pGCaG27GiaDC7c06dE57Fpt%2BOW99A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to