문제

I am stuck in the middle of this problem for a week or so now, I found a similar question posted on Qt for Symbian forum, but no body answered it.

The problem is simply that when I run the application, well it is still not an application just a prototype :), either on the emulator or on a real device, and use the physical QWERTY keyboard to type normal characters, in this case the device is in landscape orientation, the function keyPressEvent is not called, but it is called if I pressed keys such as enter, backspace, different arrows and the action key. Also this happens if I run the application on the emulator and used the development machine keyboard to type.

On the other hand, if I used the on screen mini QWERTY keyboard on the emulator, or used the development machine keyboard to type and the emulator is in portrait orientation, the keyPressEvent function get called.

Now to be more specific, I have a class that inherits from QTextEdit, I override the functions keyPressEvent and focusInEvent inside it, also I call the function setFocusPolicy inside the constructor of the class, but nothing seems to solve the problem.

Also I have to say that the code I am trying on is a modified version of the example customcompleter, and found that this issue also happens with the original code.

So guys, any one has any idea about how to solve this issue?

Regards.

도움이 되었습니까?

해결책

You might check keyReleaseEvent and/or monitor all events by overriding event(QEvent*) and verifying exactly what events are indeed being generated. A different suitable event might be being generated.

However, the behavior you've described really sounds like a bug to me. You might check the Qt Bug Tracker and/or file a bug report.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top