[Solved] Access to object properties in a tab element
-
Hi. My situation is
TabView { id: twUser Tab { id: tSurname Text { id: text2 text: 'Hello'
Is there a way to access the text properties of text2 element?
-
Hi,
inside the QML module all ids are available so you can write
text2.text
to read the value.
-
No, with TabView is different. text2 is unavailable.
Outside TabView I can access only at the tab but not at the objects inside the tab.
I can access to tSurname but I obtain an error when I try to access to text2.
Is there a way?
-
If you are outside TabView you can create a
property alias
pointing to thetext2.text
-
@mrdebug Use getTab to get the
Tab
at a particular index. Now sinceTab
inheritsLoader
you can use itsitem
property to access the item it contains. Eg:var tab = tabv.getTab(0) //get tab at index 0; tabv = id of TabView console.log(tab.item.text) //get the item and access its properties
-
Perfect!