需要有关 QTreeView 的 QAbstractItemModel 中的节点的示例吗?
问题:我正在寻找有关为 QTreeView
创建模型(基于 QAbstractItemModel
)的示例,但找不到 sane 代码。 Qt 示例基于QStandardModel
,不是很有用且复杂,互联网示例是基于python的?!代码...其他信息无法给我正确的方向。所以,这就是我所拥有的:
std::map
typedef std::map<公司数据,std::向量< ContractorData>,LessData<公司资料> >公司;
这是数据示例(CompanyName + ContractorsNames):
[Microsoft]*
[Bill Gates]
[Steve Balmer]
[...]
[Apple]*
[Steve Jobs - R.I.P.]
[Wozniak]
[OtherStuff]*
...
其中 *
表示 - 可扩展项目(父项)
等等我需要它用上面的数据创建QTreeView
!
有人可以帮忙吗?
非常感谢!
Problem: I'm looking example about creating model ( based on QAbstractItemModel
) to QTreeView
, but can't find sane codes. Qt examples are based on QStandardModel
, which is not very useful and complex, Internet examples are based on python?! codes... Other information can't gave me the right directions to go. So, here is what I have:
std::map
typedef std::map< CompanyData, std::vector< ContractorData >, LessData< CompanyData > > Companies;
Here it's data example (CompanyName + ContractorsNames):
[Microsoft]*
[Bill Gates]
[Steve Balmer]
[...]
[Apple]*
[Steve Jobs - R.I.P.]
[Wozniak]
[OtherStuff]*
...
where *
means - expandable item (parent)
And all that I need it to create QTreeView
with this data above!
Can any one help?
Many thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,由于这里没有发布任何帖子,所以我在这里发布我自己的解决方案(也使用文本过滤):
PS:类型
Companies
是其中CompanyData
,ContractorsData< /code> 是简单的结构...
祝你有美好的一天!
So, as no posts was done here, I post here my own solution (also used text filtering):
PS: type
Companies
is awhere
CompanyData
,ContractorsData
are simple structures...Have a nice day!