[Development] QPlatformInputContext needs more informations
BogDan
bog_dan_ro at yahoo.com
Sat Apr 14 22:30:02 CEST 2012
I create a small video to make sure you'll understand why I need to know the control position and size.
http://www.youtube.com/watch?v=qX157pS64BA
BogDan.
----- Original Message -----
> From: BogDan <bog_dan_ro at yahoo.com>
> To: "lars.knoll at nokia.com" <lars.knoll at nokia.com>; "development at qt-project.org" <development at qt-project.org>
> Cc:
> Sent: Saturday, April 14, 2012 10:26 PM
> Subject: Re: [Development] QPlatformInputContext needs more informations
>
>> From: "lars.knoll at nokia.com" <lars.knoll at nokia.com>
>
>> To: bog_dan_ro at yahoo.com; development at qt-project.org
>> Cc:
>> Sent: Saturday, April 14, 2012 9:40 PM
>> Subject: Re: [Development] QPlatformInputContext needs more informations
>>
>>
>> On 4/14/12 8:29 PM, "ext BogDan" <bog_dan_ro at yahoo.com>
> wrote:
>>
>>> Hello,
>>>
>>> I checked QPlatformInputContext interface and I think it needs more
>>> informations
>>
>> Not sure what you're missing. QPlatformInputContext is only there to
>> implement support for an input method, and has received quite some testing.
>>
>
> In order to be sure the user sees the entire control and its content I need to
> know
> the control position and its size, otherwise the virtual keyboard may cover the
> control and its content.
>
>>
>> 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
>>> 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
>>
>> No, but QInputMethod should have the other pieces you need.
>>
>
> Ah sorry I didn't know about QInputMethod, I checked it and it seems it
> doesn't have the information I'm looking for. I need the know the
> control
> coordinates (position and size). I'm afraid QInputMethod doesn't has
> this info.
>
>>
>>> 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.
>>
>> 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 understand, but QInputMethod doesn't contains the control position and
> size :(
>
>>> 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
> .
>>
>> See above.
>>
>> Cheers,
>> Lars
>>
>
> Cheers,
> BogDan.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
More information about the Development
mailing list