In your eventFilter for the mainWindow, you can check for the ChildAdded
event.
Nice thing is that you dont have to go looking it up and converting it :-)

class Filter(QtCore.QObject):
    def eventFilter(self, obj, event):

        typ = event.type()

        if typ == event.ChildAdded:
            hyperWidget = event.child()
            # set up stuff on the hyperWidget QWidget

        return False



On Thu, Apr 12, 2012 at 10:53 AM, Jesse Capper <[email protected]>wrote:

> Related question:
> Can you attach a persistent filterEvent to a panel like the
> hypershade? Or maybe attach a callback to the hyperShadePanel type to
> create a filterEvent every time the panel is created?
>
> I can get the QWidget for the hypershade if it already exists:
>
> hypershade_panel = cmds.getPanel(sty='hyperShadePanel')[0]
> if hypershade_panel in cmds.getPanel(vis=True):
>    ptr = mui.MQtUtil.findControl(hypershade_panel)
>
> Problem is that since the QWidget for the panel gets destroyed every
> time it is closed, I'd have to reattach the filterEvent every time it
> is reopened (or make it persistent, but I'm guessing that since the
> widget gets destroyed, that isn't possible), and I don't know how to
> do that. Is it possible, a bad idea, anything?
>
> Thanks,
> Jesse
>
>
>
> On Apr 10, 6:08 pm, notanymike <[email protected]> wrote:
> > Thanks. I somehow overlooked eventFilter from the QObject docs...
>
> --
> 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

Reply via email to