Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.9, 6.8.3
Description
A minimal reproducer is attached. It is nothing more than a template project generated by Qt Creator, except that the following locale settings are added to InputPanel:
Component.onCompleted: { VirtualKeyboardSettings.activeLocales = ["en_US", "ja_JP"]; VirtualKeyboardSettings.locale = "en_US"; }
I suppose it is a fairly common and reasonable way to set desired locales and default locale? But the very moment you click on the little "Earth" icon to try to change input method, the following warning happens:
qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Components/Keyboard.qml:1209:9: QML PopupList: Binding loop detected for property "preferredVisibleItems": qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Components/PopupList.qml:9:5 qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Components/Keyboard.qml:1209:9: QML PopupList: Binding loop detected for property "preferredVisibleItems": qrc:/qt-project.org/imports/QtQuick/VirtualKeyboard/Components/PopupList.qml:9:5
That warning points to PopupList.qml which is the ListView that shows the active locales. The problematic lines include the property that causes the binding loop:
readonly property int preferredVisibleItems: count < maxVisibleItems ? count : maxVisibleItems
And the property that "kicks off" the loop:
height: currentItem ? currentItem.height * preferredVisibleItems + (spacing * preferredVisibleItems - 1) : 0
In short, the problem is that height (geometry of ListView) depends on preferredVisibleItems which in turn depends on count which gets updated when ListView geometry gets updated. Something like:
geometry change -> count change -> preferredVisibleItems change -> geometry change -> loop.
It can also be seen from part of the stack trace (the stack trace is not from the minimal reproducer I provided here but the idea is the same):
Frame 20: geometry change
Frame 11: refill (the method to be questioned: it interfaces geometry and count)
Frame 9: count change
Then it is the property bindings in PopupList.qml that gets the loop going.
Anyway, I think the main problem here is: why count should change according to geometry? Isn't the count of a ListView simply "how many entries are there in the model"? Maybe it is more of a QtQuick.Controls issue than virtual keyboard issue. If so, feel free to reassign and relabel this report.
Update: you don't even need both locale settings. "VirtualKeyboardSettings.activeLocales" alone is enough to cause the binding loop. On the other hand, specifying "VirtualKeyboardSettings.locale" is OK.