[Development] [Android] QML Qt.inputMethod.keyboardRectangle.height always equal to 0
Sacha Zyto
sachazyto at gmail.com
Sat Jun 7 00:47:39 CEST 2014
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140606/b2ec922d/attachment.html>
More information about the Development
mailing list