I also agree. If you can avoid doing custom Qt modifications to Maya that
circumvent the official API, then you can minimize the potential for
strange behavior to crop up. Especially across versions of Maya.
Maya is free to do any number of extra operations surrounding its procedure
for adding a menu via its commands api, such as registering information
about it. You may miss that behavior if you do it with Qt directly.

On Sat, 5 Dec 2015 7:59 AM Fredrik Averpil <[email protected]>
wrote:

> I concur with Marcus. If your Maya menus are not inheriting or being
> inherited by something PySide/PyQt-based, it would be faster to just use
> the facilities offered by Adsk/the docs:
> http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/menu.html
>
> // Fredrik
>
>
> On Fri, Dec 4, 2015 at 4:18 PM Ben Hearn <[email protected]> wrote:
>
>> It was a colleague of mine, I quizzed about solutions and the suggestion
>> was go with Qt if inline with generic tools.
>>
>> Performance for drop down menus I was not really worried about I was just
>> wondering :)
>>
>> I will be experimenting with both and see which one I prefer to go with :)
>>
>> On 4 December 2015 at 15:13, Marcus Ottosson <[email protected]>
>> wrote:
>>
>>> Who recommended that? And are you really worried about the performance
>>> of your menu?
>>>
>>> Functionality-wise, you could embed Quake 3 into Google Maps and draw
>>> your menu into it with Qt so it’s safe to say it wins there. But whether
>>> you need it or not is another matter.
>>>
>>> Usability-wise, the cmds module offers less lines if all you’re looking
>>> for is a menu. Some might say, that doing a plain menu using QMenu is
>>> “re-inventing the wheel”. But again, maybe you are looking for something
>>> more than just a menu, in which case Qt is a good choice.
>>> ​
>>>
>>> On 4 December 2015 at 09:25, Ben Hearn <[email protected]> wrote:
>>>
>>>> My original plan was to use the standard cmds/pm menus for Maya but I
>>>> was recommended to stick with Qt as it ties into the Python ecosystem much
>>>> better.
>>>>
>>>> I have the drop down menu set up now but is there much a difference
>>>> functionality wise and performance wise if using Qt vs cmds/pm?
>>>>
>>>> On 4 December 2015 at 08:35, Marcus Ottosson <[email protected]>
>>>> wrote:
>>>>
>>>>> How about the goold ol’ cmds.menu?
>>>>>
>>>>> import maya.cmds as cmds
>>>>>
>>>>> cmds.menu( label='MyMenu', tearOff=True, parent='MayaWindow' )
>>>>> cmds.menuItem( label='New' )
>>>>> cmds.menuItem( label='Open', subMenu=True )
>>>>> cmds.menuItem( label='Cheese')
>>>>> cmds.menuItem( label='Pasta')
>>>>>
>>>>>
>>>>>    -
>>>>>    
>>>>> http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/CommandsPython/menu.html
>>>>>
>>>>> Qt is great and all, but sometimes the built-in methods aren’t
>>>>> actually that bad either.
>>>>> ​
>>>>>
>>>>> On 2 December 2015 at 10:02, Benjam901 <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> SOLVED:
>>>>>>
>>>>>> I was defo missing something:
>>>>>>
>>>>>> this line needed to be changed from returning QWidget to return
>>>>>> QMainWindow:
>>>>>>
>>>>>> return shiboken.wrapInstance(long(ptr), QtGui.QMainWindow)
>>>>>>
>>>>>>
>>>>>> Adding the menu using: mayaWindow.menuBar().addMenu(mainMenu) works well 
>>>>>> now :)
>>>>>>
>>>>>>
>>>>>> But in the meantime if anyone has any solid tips to consider while 
>>>>>> creating something like this please feel free to post
>>>>>>
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>>
>>>>>> Ben
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Wednesday, 2 December 2015 10:57:49 UTC+1, Benjam901 wrote:
>>>>>>>
>>>>>>> Hello all,
>>>>>>>
>>>>>>> I am rather stuck trying to add a QMenu to the main Maya window.
>>>>>>>
>>>>>>> The aim is to have a custom menu that acts like the other menus on
>>>>>>> the top bar i.e. drop down and sub options appear and inside them 
>>>>>>> various
>>>>>>> other sub options etc. etc. but I cannot seem to get my menu to pin up 
>>>>>>> just
>>>>>>> yet I think I may be missing something.
>>>>>>>
>>>>>>> I haven't added any functions to execute to it yet, still trying to
>>>>>>> get it to show up first
>>>>>>>
>>>>>>> Here is my code:
>>>>>>>
>>>>>>> import shiboken
>>>>>>> from PySide import QtGui, QtCore
>>>>>>> import maya.OpenMayaUI as apiUI
>>>>>>>
>>>>>>> def getMayaWindow():
>>>>>>>         ptr = apiUI.MQtUtil.mainWindow()
>>>>>>>         if ptr is not None:
>>>>>>>                 return shiboken.wrapInstance(long(ptr), QtGui.QWidget)
>>>>>>>
>>>>>>> def addMenuItem(myMenu=None, title='', action=''):
>>>>>>>         myMenu.addMenu(title)
>>>>>>>         #menu.addAction(action)
>>>>>>>
>>>>>>> def addSeparator(myMenu):
>>>>>>>         myMenu.addSeparator()
>>>>>>>
>>>>>>> def setupMenuBar():
>>>>>>>         print 'setting up menu bar'
>>>>>>>         mayaWindow = getMayaWindow()
>>>>>>>         mainMenu = QtGui.QMenu('Overkill_Tools', mayaWindow)
>>>>>>>         addMenuItem(mainMenu, 'TESTING', lambda: test)
>>>>>>>         #mayaWindow.menuBar().addMenu(mainMenu)
>>>>>>>
>>>>>>> def test():
>>>>>>>         print 'testing qt-ness'
>>>>>>>         
>>>>>>> setupMenuBar()
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Ben
>>>>>>>
>>>>>> --
>>>>>> 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/e5e17196-fcda-47ad-be89-0a5a5e61427d%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/e5e17196-fcda-47ad-be89-0a5a5e61427d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Marcus Ottosson*
>>>>> [email protected]
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "Python Programming for Autodesk Maya" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/python_inside_maya/IcMpXXmDnSM/unsubscribe
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAe%3DYCT7n%2BrxoxwybELuaGQKLOteZOg_wwOjzLovgid5g%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAe%3DYCT7n%2BrxoxwybELuaGQKLOteZOg_wwOjzLovgid5g%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> Tel - +46 76245 92 90 (Sweden)
>>>> LinkedIn: http://www.linkedin.com/pub/ben-hearn/50/a64/33b
>>>>
>>>> --
>>>> 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/CAM2ybkXaohCQABj3AQv-aBj1ET7MmEskidpDM1wUB0_Lmb0ZPA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkXaohCQABj3AQv-aBj1ET7MmEskidpDM1wUB0_Lmb0ZPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> *Marcus Ottosson*
>>> [email protected]
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/python_inside_maya/IcMpXXmDnSM/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOARe--XYSHkRWMoDNB-pA%3D8kKVWxv5hVscr9%3DYiCUxjLA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOARe--XYSHkRWMoDNB-pA%3D8kKVWxv5hVscr9%3DYiCUxjLA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>>
>> Tel - +46 76245 92 90 (Sweden)
>> LinkedIn: http://www.linkedin.com/pub/ben-hearn/50/a64/33b
>>
>> --
>> 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/CAM2ybkXS9fubrMMN-or0OBsOqQZ5FXiP%2BEH_7iCnnu7tNV4cvg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkXS9fubrMMN-or0OBsOqQZ5FXiP%2BEH_7iCnnu7tNV4cvg%40mail.gmail.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/CAD%3DwhWNZ4YR4wc2Oz-rMS4p_GtajQgbcEfofy1t7WwJKq5-V4A%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNZ4YR4wc2Oz-rMS4p_GtajQgbcEfofy1t7WwJKq5-V4A%40mail.gmail.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/CAPGFgA0Y-ZV4WLmCgHNFNHdLSPxncGwRqQtch0U5CsV%2BgSj8WA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to