[Development] [Android] QML Qt.inputMethod.keyboardRectangle.height always equal to 0

Ben Lau xbenlau at gmail.com
Sat Jun 7 21:01:21 CEST 2014


I think it is not implemented yet. There are few reported issues about
using virtual keyboard in Android.

*[#QTBUG-33713] Not possible to get boundaries of virtual keyboard on
android in order to align other stuff on it - Qt Bug Tracker*
*[#QTBUG-34089] Android: user input items filling the screen height won't
show well when keyboard is shown - Qt Bug Tracker*
*[#QTBUG-36027] Android: Support configuring software keyboard resizing
behavior - Qt Bug Tracker*
*[#QTBUG-34401] Qt on Android does not seem to respect
android:windowSoftInputMode in manifest - Qt Bug Tracker*



On 7 June 2014 06:47, Sacha Zyto <sachazyto at gmail.com> wrote:

>  Hello everyone,
>
> I'm using Android 4.4.3 on a nexus 5, with Qt 5.3.0, GCC 4.8. I've noticed
> that the reported height of the virtual keyboard seems to be always 0.
> For instance, in the following example...
>
> import QtQuick 2.2
> import QtQuick.Controls 1.1
> import QtQuick.Layouts 1.1
>
> ApplicationWindow {
>     visible: true
>     title: qsTr("softkeyboard test")
>     Flickable{
>         flickableDirection: Flickable.VerticalFlick
>         anchors.fill: parent
>         contentHeight: my_contents.height
>         ColumnLayout{
>             id: my_contents
>             spacing: 200
>             Repeater{
>                 model: 20
>                 TextInput{
>                     text: "editme #"+index
>                 }
>             }
>         }
>     }
>     Component.onCompleted: {
>         Qt.inputMethod.visibleChanged.connect(showKeyboardStats)
>     }
>     function showKeyboardStats(){
>         console.log("virtual keyboard stats: visible: "+
> Qt.inputMethod.visible+", height:
> "+Qt.inputMethod.keyboardRectangle.height);
>     }
> }
>
>
> When I run this example, I can see the following message on the log
> output, when I expand the virtual keyboard:
> D/Qt      (23256): qrc:///main.qml:27 (showKeyboardStats): qml: virtual
> keyboard stats: visible: true, height: 0
>
> ... and this message when I collapse it:
> D/Qt      (23256): qrc:///main.qml:27 (showKeyboardStats): qml: virtual
> keyboard stats: visible: false, height: 0
>
> As you can see, the height of the visual keyboard is always 0, as reported
> by Qt.inputMethod.keyboardRectangle.height
> Any help would be greatly appreciated.
>
> Best,
> Sacha
>
> PS: Some context of of why I care about this:
> I've noticed that in QML apps on Android, the user isn't able to scroll
> all the way down the app when the virtual keyboard is expanded. In the
> example above, if I select, say "editme #2", I can only scroll to see
> "editme #16", but not the last element ("editme #19"). I thought that a
> quick fix could be to add a blank Item at the bottom and set its height to
> the height of the virtual keyboard, but this supposes that I can find the
> height of the virtual keyboard... Of course, if there's another way to
> solve this issue, I'm interested.
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140608/f28415c5/attachment.html>


More information about the Development mailing list