Drag & drop buttons

Hi,

I’m trying to create a pyqt ui in Maya and I want to be able to use the drag and drop function of Maya’s shelfButton. I get stumped on the fact that I don’t know what type of object a shelfButton is to Qt as this isn’t something listed in the Qt class/modules. Is it possible to use the shelfButton, if so how?

Thanks!

Maya’s shelfButton is just a Qt Pushbutton with an image. If you need to interact with the Maya shelf you will need to use cmds.shelfButton rather than PyQt.
If you are making your own UI from scratch you can just set an icon on a PushButton and adjust the stylesheet to suit your needs. (Most likely just border: 0px solid transparent;)

For drag and drop between your PyQt ui and Maya’s ui you may have to use a shelfButton created via cmds.shelfButton, rather than PyQt (Because Maya can’t “know” about widgets created outside of it’s commands)

How do I create a shelfButton via cmds.shelfButton?

Or maybe I should not try to use Maya’s shelfButton at all. If my pyqt ui can have a selection with drag enabled on, can I add it onto my maya’s shelf with a pretty icon and all? If so, how?