View Full Version : How use Model view with a tree wich have Cycle ?
weepdoo
8th December 2008, 12:34
Hy,
I've got a tree with cycle in it, and I would like to represent it in Qt, how can I ?
Because the parent for a QModelIndex is not always the same, so how can we handle it ?
Thanks
wysota
8th December 2008, 13:24
A tree by definition has no cycles :) If you want to represent a graph, you won't be able to show it in one of the standard views anyway, so the implementation of parent has less meaning. Just return a proper parent index for the item, if it has two parents, return always the same one. There is a chance it will work although be aware the architecture was not built for such uses. It might be better to store the data as a neighbourhood matrix or not to use itemviews at all.
weepdoo
9th December 2008, 17:05
Thanks for the tips.
I'm going to doing it manualy ;)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.