it works fine if I install the filter on the main window, so I end up
creating 2 filter one for mouse click on the main window and another for
mouse pos on the GLWidget..
this is for use in conjunction with a MPxContext by the way = )
thanks!

luiz

On Wed, Feb 13, 2013 at 7:28 PM, Justin Israel <[email protected]>wrote:

> 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.
> On Feb 14, 2013 8:18 AM, "Ravi Jagannadhan" <[email protected]> wrote:
>
>> Sorry, I should've clarified, I was asking you :) I wonder if the OS
>> setting overrides the behaviour, which is why I'd asked.
>>
>>
>> On Wed, Feb 13, 2013 at 11:16 AM, Justin Israel 
>> <[email protected]>wrote:
>>
>>> Not sure if that question was directed at me or Luiz, but I am using
>>> click to focus for my linux setting. But I would assume an explicit
>>> setFocus() call would do it. It is required for me to even see a reaction
>>> after I then click and start pressing keys, but I also tried to
>>> grabKeyboard which made no difference in terms of requiring the click.
>>>
>>>
>>> On Feb 14, 2013, at 8:04 AM, Ravi Jagannadhan wrote:
>>>
>>> If this is on Linux, what is your mouse focus policy in the OS? Is it
>>> click to focus?
>>>
>>>
>>> On Wed, Feb 13, 2013 at 11:01 AM, Justin Israel 
>>> <[email protected]>wrote:
>>>
>>>> Sent too quickly...
>>>> I meant to say that just calling setFocus() still seems to require a
>>>> click before it really grabs the keyboard:
>>>>
>>>> http://pastebin.com/KfpjXABm
>>>>
>>>> import sip
>>>> import maya.OpenMayaUI as OpenMayaUI
>>>> from PyQt4 import QtGui, QtCore
>>>>
>>>> class MouseEventFilter(QtCore.QObject):
>>>>     def eventFilter(self, obj, event):
>>>>         typ = event.type()
>>>>         if typ == event.Enter or typ == event.MouseButtonPress:
>>>>             print "mouse enter"
>>>>             obj.setFocus()
>>>>         elif typ == event.Leave:
>>>>             print "mouse leave"
>>>>             obj.clearFocus()
>>>>         elif typ == event.KeyPress:
>>>>             print "working..."
>>>>             return True
>>>>         return False
>>>>
>>>> view = OpenMayaUI.M3dView.active3dView()
>>>> widget = sip.wrapinstance(long(view.widget()), QtCore.QObject)
>>>> eventFilter = MouseEventFilter()
>>>> widget.installEventFilter(eventFilter)
>>>>
>>>> # remove
>>>> widget.removeEventFilter(eventFilter)
>>>> eventFilter.deleteLater()
>>>>
>>>>
>>>> On Feb 14, 2013, at 7:56 AM, Justin Israel wrote:
>>>>
>>>> I got it working after a click occurs in the viewport, but not when you
>>>> just try and call setFocus() on the widget.
>>>>
>>>>
>>>> On Feb 13, 2013, at 11:35 PM, luiz elias wrote:
>>>>
>>>> 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!
>>>>
>>>>
>>>>
>>>> --
>>>> 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 [email protected].
>>>> To post to this group, send email to
>>>> [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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 [email protected].
>>>> To post to this group, send email to
>>>> [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Where we have strong emotions, we're liable to fool ourselves - Carl
>>> Sagan
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected]
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>>
>>>  --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected]
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Where we have strong emotions, we're liable to fool ourselves - Carl
>> Sagan
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to