[Development] QPlatformInputContext needs more informations
lars.knoll at nokia.com
lars.knoll at nokia.com
Sat Apr 14 20:40:18 CEST 2012
On 4/14/12 8:29 PM, "ext BogDan" <bog_dan_ro at yahoo.com> wrote:
>I checked QPlatformInputContext interface and I think it needs more
Not sure what you're missing. QPlatformInputContext is only there to
implement support for an input method, and has received quite some testing.
QInputMethod (see QGuiApplication::inputMethod()) is the remaining
interface that are probably missing right now.
>and also I found one of them a little bit strange.
>I've learn that using the following code I can get the needed
>informations about the
> QInputMethodQueryEvent query(queries);
> QGuiApplication::sendEvent(qGuiApp->focusObject(), &query);
>Sadly "query" doesn't contain enough information to correctly display the
>and the edit control. I need to know where is and what is the control
>size on the
No, but QInputMethod should have the other pieces you need.
>screen, because an edit control can be anywhere and it can have any size
>on the screen,
>to be sure the user will see the entire control and its content, the
>screen must be panned
>or resized (depending on controls size). To fix this problem I just added
>implement a new enum element to Qt::InputMethodQuery : "ImRectangle - The
>rectangle of the widget in screen coordinates.". I chose screen
>coordinates and not
>widget coordinates because I think widget coordinates are useless as long
>focused item is an qobject and it can be anything. This is the reason why
>Qt::ImCursorRectangle value a little bit strange, IMHO
>represents screen coordinates, not widget coordinates.
This is wrong. QInputMethod gives that info. The reason this won't work is
the same as with the microFocusHint in Qt 4. Often the control doesn't
know when it has been moved around on the screen, so it can't give proper
feedback to the input method. So use the API in QInputMethod, as it'll
also work and give correct answers when the widget or QML item has been
moved around inside the window.
>I also attached a small patch which adds ImRectangle to
>the needed implementation in qtbase.
>Before I go further (add the needed implementation to qdeclarative, and
>push them to
>codereview) I'd like to know what are your thoughts on this matter .
More information about the Development