From 49dc8b9065af8e549260650f5d3638ebaf82e1aa Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 30 Mar 2020 09:24:19 -0700 Subject: [PATCH] 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 --- mobile-widgets/qml/DiveDetails.qml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 4636e5ee0..b102d7206 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -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 {