[Development] QPlatformInputContext needs more informations

BogDan bog_dan_ro at yahoo.com
Sat Apr 14 20:29:19 CEST 2012


Hello,

I checked QPlatformInputContext interface and I think it needs more informations 

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
focused control:

    QInputMethodQueryEvent query(queries);
    QGuiApplication::sendEvent(qGuiApp->focusObject(), &query);


Sadly "query" doesn't contain enough information to correctly display the keyboard
and the edit control. I need to know where is and what is the control size on the
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 and
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 as the
focused item is an qobject and it can be anything. This is the reason why I've found
Qt::ImCursorRectangle value a little bit strange, IMHO Qt::ImCursorRectangle should
represents screen coordinates, not widget coordinates.

I also attached a small patch which adds ImRectangle to Qt::InputMethodQuery and
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 .


Thank you.


Cheers,
BogDan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: im.diff
Type: text/x-patch
Size: 5251 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120414/24c43498/attachment.bin>


More information about the Development mailing list