aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2023-09-03 23:41:17 +0300
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-05 08:13:56 +0000
commitaa610720c97ae92af0804dfb3fc03f04aadae26d (patch)
treebc3e112ba6a3e7262dc6a30cd00fdd72a6a285ba
parentaf98273ffc70a3819ffb8a20cac37a855e2ddeaf (diff)
Fix binding loop warning emitted by inputpanel test
zh_TW has only two supported input modes Zhuyin and Cangjie. At the time locale is set to zh_TW and the main layout is loaded, inputMode is not yet set to Zhuyin or Cangjie, because the input method is created by the layout and the default input mode is defined by the input method. The binding loop happens, because in the test case the inputMode is Latin during creation: create: inputMode === Latin -> Cangjie default: inputMode === Zhuyin -> Zhuyin test: inputMode === Cangjie -> Cangjie Fix by setting sourceComponent to null if the inputMode is not yet set to supported input mode. Change-Id: I1c9bcccc5655e3ec1553e6e5414b47733eba5b82 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 2f0565fbdb2683ba336daff9c9e27cf88dff9a0b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/layouts/zh_TW/main.qml11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/layouts/zh_TW/main.qml b/src/layouts/zh_TW/main.qml
index e9643da3..a839b5dd 100644
--- a/src/layouts/zh_TW/main.qml
+++ b/src/layouts/zh_TW/main.qml
@@ -11,7 +11,16 @@ KeyboardLayoutLoader {
return Qt.createQmlObject('import QtQuick; import QtQuick.VirtualKeyboard.Plugins; TCInputMethod {}', parent, "main.qml")
}
sharedLayouts: ['symbols']
- sourceComponent: InputContext.inputEngine.inputMode === InputEngine.InputMode.Cangjie ? pageCangjie : pageZhuyin
+ sourceComponent: {
+ switch (InputContext.inputEngine.inputMode) {
+ case InputEngine.InputMode.Cangjie:
+ return pageCangjie
+ case InputEngine.InputMode.Zhuyin:
+ return pageZhuyin
+ default:
+ return null
+ }
+ }
Component {
id: pageCangjie
KeyboardLayout {