November 18, 2010

bundickt bundickt
Lab Rat
53 posts

Creating a dynamic tree like user interface with qml

 

I am trying to create an application where all the data is organized in a tree like structure stored in many xml files.
There is a root.xml file containing a bunch of elements.
Each element contains the data i want to display to the user and it may also contain a “link” to another xml.
The elements will be displayed in a list view to the user.
If an element contains a link to another xml file I will allow the user to select that element to show another list of items.
The linked xml file will have the same rules as the root.xml; may contain links to other xml files.
This will allow me to configure the application’s tree with xml files.
I would like to know the best way about doing this.
I have created a way that dynamically creates list views, but it seems that I need to put lots of work around in my qml application to make things stable and not crash or do things that were not intended.

4 replies

November 19, 2010

Schneidi Schneidi
Lab Rat
86 posts

Sounds like an interesting approach.

I don’t really have an idea to something like this, but I would be interested in
some ideas to this kind of approach.

November 20, 2010

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

I think it should be possible with xmlmodel and one listview. You can simply attach link as xmlrole and in delegate in mousearea you can change source of xmlmodel. Will it be ok for you or I’m wrong somewhere?

November 21, 2010

Kxyu Kxyu
Lab Rat
145 posts

the question is whether you want to display root and inner xml elements simultaneously or not.
if you do then use listview in your delegate, if not – just change source property of the model

November 22, 2010

bundickt bundickt
Lab Rat
53 posts

I need to be able to show the parent and child xml lists at the same time for a nice looking transition, but once the transition is over I will only need to show one list. Another challenge is that I need the last selected item the user saw when leaving a list to be remembered; so when the user returns to that list it will be as they left it. I am doing that by storing the indexes of each list’s selected item in an associative array, and that seems to work.

Denis, your approach sounds pretty interesting. I will have to use two list views, but I could do a round robin kind of thing for the two list views. And I would have to store a history (stack or have children store links to there parent xml file) so the user could navigate in both directions.

Thanks for the ideas

 
  ‹‹ Qml List View Crash      Keeping track of user Preferences ››

You must log in to post a reply. Not a member yet? Register here!