mobile/dive-details: don't show virtual keyboard in dive view mode

At least in 4.9.3.1258/3.0.1 I was able to reproduce a situation where I
edit one dive, go back to the dive list, then tap on a different dive
and then the keyboard pops up, obscuring a big chunk of the screen.

This tries to make sure the keyboard isn't shown in dive view mode.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-30 09:24:19 -07:00
parent 085b5ff0db
commit 49dc8b9065

View file

@ -197,6 +197,23 @@ Kirigami.Page {
}
]
Component.onCompleted: {
// when we first create this page, we are in "view" mode and shouldn't show
// a virtual keyboard. This should be unnecessary, but in some circumstances,
// when the user editied a dive, went back to the dive list, and then tried to
// view a different dive, the Android keyboard would pop up
Qt.inputMethod.hide()
}
onHeightChanged: {
// even with the explicit attempt to hide the keyboard above, it STILL sometimes
// pops up when first showing a dive. So let's get more aggressive
// QML doesn't let me trigger this based on the visible property of the inputMethod,
// but when it becomes visible, the height of the page changes, so let's use that
if (Qt.inputMethod.visible && state === "view")
Qt.inputMethod.hide()
}
property QtObject deleteAction: Kirigami.Action {
text: qsTr("Delete dive")
icon {