I have a TabbedPane
with two tabs. The first has ListView
which opens a message composing view when an element in the list view is selected.
TabbedPane {
attachedObjects: [
ComponentDefinition {
id: cmp_page
// ... other UI elements for this page
}
]
Tab { // First tab
NavigationPane {
id: tmp_nav
Page {
ListView {
onTriggered: {
var pg = cmp_page.createObject()
tmp_nav.push(pg)
}
}
}
}
}
Tab { // Second Tab whose contents should be "cmp_page"
id: should_be_cmp_page
// ... UI elements, the same in cmp page
}
}
I am trying to get rid of this duplication to
- make my code smaller
- reduce the number of signal-slot handling I have to do
What I tried
- opening
should_be_cmp_page
in theonTriggered
method in the first tab- error:
TypeError: Result of expression 'should_be_cmp_page.createObject' [undefined] is not a function.
- error:
- considered but not attempted: create the attached object in the tab view; but this is not a
NavigationPane
and I don't think making it one for this sole purpose is the most ideal solution.