Looking at your example code, there are a couple of things missing.
- You don't set a parent for your QMainWindow. Without a parent, it doesn't
have any hierarchy in the Maya UI. You've noted that you tried setting a
parent, but maybe it didn't work? Can we see the code you tried?
- You don't give either of your objects objectNames.
With no parent and no objectName, fullName will definitely return empty.
On Saturday, 24 June 2017 02:43:49 UTC+10, oglop wrote:
>
> I thought you have to set object names before using that function ?
>
> win.setObjectName('test object name')
> widget.setObjectName('test widget name')
>
> mui.MQtUtil.fullName(long(shiboken2.getCppPointer(win.centralWidget())[0]))
> # Result: u'test object name|test widget name' #
>
>
>
> On Friday, June 23, 2017 at 8:47:12 AM UTC-7, darkgaze wrote:
>>
>> I'm trying to setup a scriptJob for a Qt window.
>> But in order to do that, I need the name of the window in the UI
>> hierarchy.
>>
>> You probably know, we can set the Object Name to a Qt object to get names
>> for the windows
>> |parentname|childname|...
>>
>> instead of empty strings:
>> |||...
>>
>>
>>
>> The problem with a QMainWindow, its central widget, or whatever widget
>> you are trying to query, is that the path is not fully unique... and if you
>> send that to the API, it returns an empty string or fails.
>>
>> win = wdg.QMainWindow() // no matter if I assign a parent to the maya
>> window
>> wdg.QWidget()
>> win.setCentralWidget(wdg.QWidget())
>> win.show()
>>
>>
>> The full name is always empty.
>>
>>
>> mui.MQtUtil.fullName(long(shiboken2.getCppPointer(win.centralWidget())[0]))
>>
>> No matter what I do.
>>
>> I know there must be a way to fix the hierarchy path to a window you
>> create in Qt... it must be really easy.
>>
>>
>> Thanks!
>>
>> --
>> Lidia
>>
>
--
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/cec0b255-996d-4b69-8629-fcc812428ff4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.