Oh. I finally get what you mean. The key press event works for the parent
app but when the text edit has focus, it is performing its own key press
event to do the text input.  Thus it is accepting your key press and it
never even reaches your parent.
You could install the parent as the event filter for the text edit. Then
just watch for the text edit and a key press type. Then the operation would
be the same as your current key press event code.
You might even set the parent widget to be an event filter on itself and
watch for both widgets key presses and handle the same thing in one spot.
Or move the handler code to another method, check the key event of the
parent in keyPressEvent and the text edit in the event filter, and call
that common handler if they pressed the right key.

On Tuesday, December 4, 2012, Sudeepth Patinjarayil wrote:

> Hello Justin,
>
> I am sorry my question was not clear. My problem is that when i click the
> QTextEdit and type a line and press a key in NUM pad (Eg : 0). my keypress
> event is not working. its showing "0" in the QTextEdit . But if i press NUM
> pad key zero, i want  it actually print a sentence from text file. Am i
> missing something or it will be that way. or can i do it some other way.
>
> Thanks and Regards,
> Sudeepth Patinjarayil.
>
> --
> 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