aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2021-02-12 15:46:03 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-13 07:28:13 +0000
commit49d3b96dbc8ff32924ed46795f86bdc7472faa69 (patch)
treefef936126295ead8bcbdeb6c7c3d8de26f12c56c
parent7c3fa948bb5b67ce892348e7b95ec26c8baad86b (diff)
Replace layoutChangeNotifyTimer with Qt.callLater
The layoutChangeNotifyTimer is used internally by the Keyboard to delay the notification of keyboard changed event to keyboard observer component. This is to avoid subsequent notification calls. Use of timer is not perhaps the best way to accomplish this. This change replaces the timer with Qt.callLater, which will do the same but without the additional delay. Change-Id: I9bbefb47ddd0daa64096bd676c25da4e94bcd33d Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit d0c551618e9614d2a855bc7cae336697e786a616) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/virtualkeyboard/content/components/Keyboard.qml10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/virtualkeyboard/content/components/Keyboard.qml b/src/virtualkeyboard/content/components/Keyboard.qml
index 25f9142b..8e96401c 100644
--- a/src/virtualkeyboard/content/components/Keyboard.qml
+++ b/src/virtualkeyboard/content/components/Keyboard.qml
@@ -829,12 +829,6 @@ Item {
Component.onCompleted: InputContext.priv.setKeyboardObserver(keyboardObserver)
- Timer {
- id: layoutChangeNotifyTimer
- interval: 50
- onTriggered: if (keyboardLayoutLoader.item != null) keyboardObserver.layoutChanged()
- }
-
onWidthChanged: notifyLayoutChanged()
onHeightChanged: notifyLayoutChanged()
@@ -1720,6 +1714,8 @@ Item {
}
function notifyLayoutChanged() {
- layoutChangeNotifyTimer.restart()
+ Qt.callLater(function() {
+ if (keyboardLayoutLoader.item != null) keyboardObserver.layoutChanged()
+ })
}
}