How to get item ID from one qml file to other qml file
-
Hi,
I am working on some keyNavigation, I have a item(Gridview) in one qml file and want to use keyNavigation for it, I want to assign it to an item which is in other qml file. So, how can I get that item from that qml file and assign it to keynavigation.up:
Thanks.
-
Hi,
I am working on some keyNavigation, I have a item(Gridview) in one qml file and want to use keyNavigation for it, I want to assign it to an item which is in other qml file. So, how can I get that item from that qml file and assign it to keynavigation.up:
Thanks.
-
@RG90 It's difficult to follow "item", "it" and "that" in your question, so can you give a code example?
QML 1 file
FocusScope{id: view objectName: "view" anchors.fill: parent Flickable{ id: menuFlick anchors.fill: parent ListView{ id: pages } GridView { id: grid KeyNavigation.up: "itemID" // titlebar to be assigned KeyNavigation.priority: { switch(currentIndex) { case 0: case 2: case 4: case 6: case 8: case 10: case 12: case 14: case 16: KeyNavigation.BeforeItem; break; default: KeyNavigation.AfterItem; break; } } }
}
QML 2 file
FocusScope{id: titlebar
focus: true
anchors.fill: parent
}
Note: An these two files are in different folder.Now, I want assign titlebar ID of QML 2 file to GridView of first QML 1 file. how can we do it
-
QML 1 file
FocusScope{id: view objectName: "view" anchors.fill: parent Flickable{ id: menuFlick anchors.fill: parent ListView{ id: pages } GridView { id: grid KeyNavigation.up: "itemID" // titlebar to be assigned KeyNavigation.priority: { switch(currentIndex) { case 0: case 2: case 4: case 6: case 8: case 10: case 12: case 14: case 16: KeyNavigation.BeforeItem; break; default: KeyNavigation.AfterItem; break; } } }
}
QML 2 file
FocusScope{id: titlebar
focus: true
anchors.fill: parent
}
Note: An these two files are in different folder.Now, I want assign titlebar ID of QML 2 file to GridView of first QML 1 file. how can we do it