The problem is related to the fact that tabs are "instantiated" only on demand. The first tab is always instantiated, so if you put the objectName
there it will be found.
It will be found in the second tab only if you instantiate the second tab (select it). Similarly, using findChild
on the TabView
probably instantiates each tab (since it looking for them), so after that a findChild
works even if second tab was not selected.
Conclusion: instantiate all tabs first (doing a findChild
on the TabView
is one way but may be a hack), then do the findChild
for the item.