summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-04-14 14:03:51 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-04-14 14:04:34 -0700
commitc00b14af9ace747509988ba570972501ad5347f6 (patch)
tree3298b0e594d0140dd8221ff9454805664b78be43
parentee4ae49d37043f8b9a7f971cfefb758a7893f492 (diff)
downloadsubsurface-c00b14af9ace747509988ba570972501ad5347f6.tar.gz
QML UI: better simulation of onPressed in TextField
Prior to Qt Quick Components 2.1 there was no onPressed signal for a TextField; in order to be able to build against Qt 5.7 (which comes with Qt Quick Components 2.0) we need to work around the lack of this signal. This code seems to do a pretty good job at simulating it. My attempt in commit 73c66e1d7d9f ("QML UI: make run with Qt 5.7 again") didn't work so well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/HintsTextEdit.qml8
1 files changed, 7 insertions, 1 deletions
diff --git a/mobile-widgets/qml/HintsTextEdit.qml b/mobile-widgets/qml/HintsTextEdit.qml
index fb9cee417..508c83907 100644
--- a/mobile-widgets/qml/HintsTextEdit.qml
+++ b/mobile-widgets/qml/HintsTextEdit.qml
@@ -13,7 +13,13 @@ TextField {
onTextChanged: {
textUpdateTimer.restart();
}
- Keys.onPressed: frame.shouldShow = !frame.shouldShow
+ onFocusChanged: frame.shouldShow = focus
+ onVisibleChanged: {
+ if (visible) {
+ focus = false
+ frame.shouldShow = false
+ }
+ }
Keys.onUpPressed: {
hintsView.currentIndex--;
}