In my QML application I have a TabView, Tabs and a few Buttons and Text fields. I need to access them using custom function from outside TabView component which is called by button from inside a Tab.
My code is pretty simple:
ApplicationWindow {
function showText() {
console.log(tabView.testText);
}
TabView {
id: tabView
property alias testText: test.text
Tab {
title:'tab1'
RowLayout {
Button {
text:"PRINT"
onClicked: {
showText()
}
}
Text {
id:test
text:'Test123'
}
}
}
Tab {
title:'tab2'
}
}
}
but I get error message for the alias creation line:
Invalid alias reference. Unable to find id "test"
What is wrong with it? I've followed similar question on SO (ReferenceError in qt quick controls tabview) but the code doesn't work either.