Maya QT windows – inaccessible titlebars
- July 13th, 2011
- Write comment
The very first time you call a QT interface window (in a given user preferences set), it will draw the window so that the titlebar is offscreen. Problematic, because you can’t move the window, and it tends to freak your users out.
This is because Maya doesn’t have a window pref for it yet, and it’s default is brain meltingly stupid. Mac maya doesn’t suffer from this problem. Not sure about Linux.
So, use this function after you showWindow(). For example:
uiFile = "/path/to/uiFile.ui" rlDialog = cmds.loadUI(f=uiFile) cmds.showWindow(rlDialog) windowPosFix(rlDialog) def windowPosFix(windowName): """ Fix for QT windows with no position information. If they are positioned at the very top left of screen, they are moved somewhere more sensible. @param windowName: Window Name @type windowName: String """ if cmds.window(windowName, query=True, exists=True): winPos = cmds.window(windowName, query=True, topLeftCorner=True) if winPos[0] <=0 or winPos[1] <=0: cmds.window(windowName, edit=True, topLeftCorner=[150,150])