Sweet. You are right, that does work. Good to know :-)
Test snippet for notanymike:
import maya.OpenMayaUI as mui
from PyQt4 import QtCore, QtGui
import sip
class Filter(QtCore.QObject):
def eventFilter(self, obj, event):
print "eventFilter:", obj, event.type()
return False
ptr = mui.MQtUtil.mainWindow()
mainWin = sip.wrapinstance(long(ptr), QtGui.QMainWindow)
f = Filter()
# enable
mainWin.installEventFilter(f)
# disable
mainWin.removeEventFilter(f)
On Tue, Apr 10, 2012 at 5:25 PM, Chad Vernon <[email protected]> wrote:
> You can attach an EventFilter to the window. I did that to intercept key
> presses to do something else before sending it on to Maya.
>
>
> On Tue, Apr 10, 2012 at 4:47 PM, Justin Israel <[email protected]>wrote:
>
>> This is just a guess, since I haven't put too much time into checking,
>> but I think you might need to do this in C++.
>> The pointers that you wrap from sip -> PyQt QWidget don't seem to
>> register any effect to having their event methods overloaded. Maybe someone
>> else has more insight on this than me?
>>
>>
>> On Tue, Apr 10, 2012 at 11:54 AM, notanymike <[email protected]>wrote:
>>
>>> I'd like to query changes of the mouse and keyboard state from Maya's
>>> main window by adding callbacks inside of MQtUtil.mainWindow(), without
>>> adding any user-defined QWidgets to the window. Is it possible to just
>>> access events from the main window's widget without passing that widget
>>> into a user-defined QWidget class as its parent?
>>>
>>> --
>>> 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
>>
>
> --
> 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