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.
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