I think that approach works just fine. They obviously didn't use the
QMainWindow status bar when they built the UI. Its just a separate child. It
would have been more convenient for you if in their code they had done
.setStatusBar() to their child widget so that calling .statusBar() would return
it.
Typo?
statusBar.showMessage()
instead of...
> statusBar.setMessage()
On May 11, 2012, at 4:44 PM, jdob wrote:
> I have the main window as a pyqt object and wanted to set the status message
> using QMainWindow's statusBar(). Simple enough, right? Well, it seems that
> QMainWindow.statusBar() expects the status bar to be a child of the main
> window (directly) or it will create a new one - bummer. This is kind of a
> problem since maya's status bar is buried buried way down in a toolbar.
>
> I found a workaround that works but I have to make some assumptions, so I'm
> wondering if anyone else has a better solution. Here's what I'm doing:
>
> # get main window as a pyqt widget
> from PyQt4 import QtCore, QtGui
> import maya.OpenMayaUI as mui
> import sip
> ptr = mui.MQtUtil.mainWindow()
> mainWindow = sip.wrapinstance(long(ptr), QtCore.QObject)
>
> # now I'm in pyqt land...
> statusBar = mainWindow.findChild(QtGui.QStatusBar)
> statusBar.setMessage('would you like to play a game?')
>
> Anybody got a better solution?
>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe