Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Menu Navigation - problem with nesting ListModels
Forum Updated to NodeBB v4.3 + New Features

Menu Navigation - problem with nesting ListModels

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 532 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hawk30100
    wrote on last edited by
    #1

    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

    Update2: Just found this thread: http://qt-project.org/forums/viewthread/18562 I will try to solve my problem with help of this and will respond here

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved