本文介绍了DAG(有向无环图)-QAbstractItemModel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算在pyqt中创建一个节点图. qt提供了用于1D,2D和Tree数据的抽象模型,但是抽象类似乎因节点图而崩溃.

尤其是QAbstractModel中的父"函数返回单个父对象的QModelIndex.在DAG中,我可能会有多个父母.

我发现的一个资源是此博客文章:

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

它提供了一些有用的信息,但我似乎无法确定该模型如何表示多亲的概念.

我正在寻找有关如何在Qt中实现DAG模型的示例和建议.

解决方案

此线程名为图形的QTreeView显示(项目的多个父项)是您可以考虑的有趣资源(该案例也使用QAbstractItemModel进行了处理.) /p>

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

这篇关于DAG(有向无环图)-QAbstractItemModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 10:53