I seem to be missing a basic construct here: how to I access a value created in a QML component from a QML file that embeds it? For example, the Qt SDK includes the search box example where the SearchBox.qml component is used in main.qml.
SearchBox.qml includes:
and main.qml includes:Code:TextInput { id: textInput anchors { left: parent.left; leftMargin: 8; right: clear.left; rightMargin: 8; verticalCenter: parent.verticalCenter } focus: true selectByMouse: true }
but when I try something simple like:Code:SearchBox { id: search1; KeyNavigation.tab: search2; KeyNavigation.backtab: search3; focus: true } SearchBox { id: search2; KeyNavigation.tab: search3; KeyNavigation.backtab: search1 } SearchBox { id: search3; KeyNavigation.tab: search1; KeyNavigation.backtab: search2 }
in my main.qml file I get an undefined error.Code:Text { id: text1 x: 56 y: 78 width: 80 height: 20 text: "contents of search box 1" + search1.textInput font.pixelSize: 12 }
How do I get at the contents of the search box from my main.qml?




