Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Dynamic access to QML elements from QML
monster last edited by monster
Is there any way to have "n" TextInputs/TextEdits, and dynamically access them from another object? For example by their objectNames (I know that it is possible to do from Cpp, but I haven't found any method to do this in QML).
Thanks in advance
P.S. The need came out from an idea to use custom global keyboard, that can be set visible or not. But to make this keyboard work, I have to make dynamic match between actually clicked object (text input) and the global keyboard.
@monster You can create the TextInput using
createComponentand then after creating its object you can assign it to a js variable. You can store them for eg. in an array for further reference.
var component = Qt.createComponent("MyTextInput.qml"); var textinput = component.createObject(parent);