getting all QT/PySide Windows

1,059 views
Skip to first unread message

Todd Widup

unread,
Sep 16, 2015, 5:36:04 PM9/16/15
to python_in...@googlegroups.com
looking thru MQtUtil and the python, pymel commands, I am not finding anything like lsUI that will actually work with Qt or PySide windows. 

is there anything?

--
Todd Widup
Creature TD / Technical Artist
to...@toddwidup.com
todd....@gmail.com
www.toddwidup.com

Justin Israel

unread,
Sep 16, 2015, 5:55:07 PM9/16/15
to python_in...@googlegroups.com
MQtUtil has the findWindow() function. Once you have an actual Qt object, you have access to all the QObject methods like findChild(), findChildren(). What exact query would you like to be able to perform?


--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABBPk362z-%2Bqk6X9Gbk9DV7N6f-1Hqea2H%3DgtsbXZDotdibBdw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Todd Widup

unread,
Sep 16, 2015, 5:57:43 PM9/16/15
to python_in...@googlegroups.com
I saw findWindow, but it only works, from what I can see, if you know a windows objectName  I was looking for something, where say I have 5 PySide windows open and don't know there names, it would return their names or something like lsUI(windows=True)



For more options, visit https://groups.google.com/d/optout.

Justin Israel

unread,
Sep 16, 2015, 6:05:54 PM9/16/15
to python_in...@googlegroups.com
There are a number of ways to do this, actually. The lsUI thing from a MEL/Python (non-qt) standpoint is kind of necessary because otherwise you have no real hook into any of the UI system outside of what they expose to you. But once you have access to any of the Qt objects or the Qt framework itself, you can do a lot of different types of introspection directly.

For instance:
from PySide import QtGui

# Print out the title of all non-hidden top-level windows
tops = QtGui.qApp.topLevelWidgets()
for top in tops:
    if top.isWindow() and not top.isHidden():
        print top.windowTitle()

You could also get the maya QMainWindow and inspect its children, if you are only concerned with widgets actually parented to the MainWindow.


Todd Widup

unread,
Sep 16, 2015, 6:11:33 PM9/16/15
to python_in...@googlegroups.com
Thanks Justin that helps.

exactly what I was looking for



For more options, visit https://groups.google.com/d/optout.

Justin Israel

unread,
Sep 16, 2015, 6:24:22 PM9/16/15
to python_in...@googlegroups.com
On Thu, Sep 17, 2015 at 10:11 AM Todd Widup <todd....@gmail.com> wrote:
Thanks Justin that helps.

exactly what I was looking for

Sweeeeet.
 
Reply all
Reply to author
Forward
0 new messages