在 Gtk 中,TreePath 和 TreeIter 之间有什么区别?
我一直在学习使用 TreeView,这两种类型通常用于访问树的特定行。我真的不明白两者之间的区别。我的代码正在运行——我根据函数所需的参数在两者之间来回转换——但不是基于对原因的任何真正理解。
这两种类型有什么区别?
I've been learning to use TreeView
s, and these two types are often used for accessing a particular row of a tree. I don't really understand the difference between the two. My code is working--I convert back and forth between the two based on a function's required parameters--but not based on any real understanding of why.
What is the difference between these two types?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处有详细说明< /strong> 来自 Gtk 人员。本质上,TreePath 是一种描述模型中行的逻辑位置的方法。例如,
TreePath
“5:3:2”的意思是:这准确地描述了您通过钻取每个树级别所要查找的一个节点。
相比之下,TreeIter 是对相关节点更直接的引用,更像是指向特定节点的指针。
There's a detailed explanation of this here from the Gtk folks. Essentially, a
TreePath
is a way to describe the logical position of a row in the model. For example, theTreePath
"5:3:2" means:This exactly describes the one node you're after by drilling through each tree level.
By comparison, a
TreeIter
is a more direct reference to the node in question, more like a pointer to a specific node.