I'm trying get a eventFilter to work and get the keyboard press event,
it works fine for me with mouse events but I can't get the keyboard events to work,
i guess I'm missing something,
this is the far I got:
import sip
import maya.OpenMayaUI as OpenMayaUI
from PyQt4 import QtGui, QtCore
class MouseEventFilter(QtCore.QObject):
def eventFilter(self, obj, event):
if event.type() == QtCore.QEvent.KeyPress:
print "working..."
return True
return False
view = OpenMayaUI.M3dView.active3dView()
widget = sip.wrapinstance(long(view.widget()), QtCore.QObject)
eventFilter = MouseEventFilter(widget)
widget.installEventFilter(eventFilter)
#widget.removeEventFilter(eventFilter)
problem is that the QtCore.QEvent.KeyPress never happends =/
any ideas why??
thnaks!
Luiz
Luiz
--
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 post to this group, send email to python_in...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
it works fine if I install the eventFilter on the main window, but I can't find a way to set keyboard focus for the QGLWidget.
thanks!
Gah. I just realized that when I had tested this the other day, it was on my Mac. So I can't speak for Linux but I can test that theory when I get to work.
Strangely when I set focus for normal widgets like a line edit, they grab the keyboard. So maybe its a bit different for Maya based Qt widgets.