DAG (Directed acyclic graph) - QAbstractItemModel

跟風遠走 提交于 2019-12-20 05:27:31

问题


I am planning on creating a Node Graph in pyqt. The abstract models that qt provides work for 1D, 2D and Tree data but the abstract class seems to break down for something like a node graph.

In particular the "parent" function in QAbstractModel returns QModelIndex of a single parent. In a DAG I will may have multiple parents.

One resource I found was this blog post:

http://invalidmagic.wordpress.com/2009/12/10/qgraphicsscene-used-as-a-qabstractitemmodel/

It provides some useful information, but I can't seem figure how the model represents the concept of multiple parents.

I'm looking for examples and suggestions for how to implement a DAG model in Qt.


回答1:


This thread entitled QTreeView display of graph (multiple parents of item) is an interesting resource that you can consider (It also addresses using QAbstractItemModel for the case).



来源:https://stackoverflow.com/questions/9712559/dag-directed-acyclic-graph-qabstractitemmodel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!