Hello dear community,
I have a little big problem with my menu navigation.
I just wanted to make a navigation using ListModels and one ListView.
My idea was to change the model of the ListView when an user clicks on a MenuItem.
For example:
ListModel {
id: mainMenu
ListElement { title: "Navigation" },
ListElement { title: "Settings" },
ListElement { title: "Quit Application" }
}
ListModel {
id: navigationMenu
ListElement { title: "Google Maps" },
ListElement { title: "OVI Maps" },
ListElement { title: "OpenStreetMaps" },
ListElement { title: "Back to MainMenu" }
}
My idea was to determine wether an action should be called (e.g. “start application Google Maps) or if the menu should be updated with another model (e.g.: user clicked on Navigation -> Navigation menu should be displayed: google maps, ovi maps, …)
My problem is that I can not use existing objects as property in a model.
Example:
ListModel {
id: mainMenu
ListElement { title: "Navigation", model: navigationMenu },
ListElement { title: "Settings" },
ListElement { title: "Quit Application" }
}
Qt tells me that it is not possible to call a function within a script or something similiar.
Therefore I can not create a generic menu function like this: changeMenu(newModel)
Is there any possibility to have a pointer to an object in qml?
Or a way to get a specific object? ( getObjectById(“navigationMenu”)
Do you have a better idea or suggestions how to implement such a menu?
Update: I am developing for Android 4.4 with Qt 5.2
↧