From c00b14af9ace747509988ba570972501ad5347f6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 14 Apr 2017 14:03:51 -0700 Subject: 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 --- mobile-widgets/qml/HintsTextEdit.qml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qml') 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--; } -- cgit v1.2.3-70-g09d2