树视图里面的树视图?或如何在树视图中显示列表
我有一个列出对象属性的树视图。这些属性之一是标签(字符串)列表,可以是零到任意数量的项目的列表。所以你可以用“爵士乐”、“最喜欢的”和“放松”等标签来标记一首歌曲。目前,我将它们实现为单个字符串,并用逗号分隔每个标签,但我想要一个更直观的用户界面。所有其他属性都显示在 2 列树视图中,其中第一列是属性名称,第二列是属性值。
它认为做到这一点的一种方法是在标签行的第二列中放置另一个树视图,用户可以单击一行来编辑/删除它,或者有一个“添加新标签...”行让他们添加新标签标签。
我怎么可能这样做呢?或者,有什么不同的 GUI 建议吗?
I have a treeview that lists the properties of an object. One of those properties is a list of Tags (strings) that can be a list of zero to whatever number of items. So you could tag a song with "Jazz" and "Favourite" and "Chillout" or whatever. At the moment I have these implemented as just a single string with commas separating each tag but I'd like a more intuitive user interface. All of the other properties are shown in a 2 column treeview where the first column is the property name and the second column is the property value.
It thought one way to do this would be to place another treeview inside the second column in the tags row where users can click a row to edit/delete it or there's be a "Add new tag..." row that lets them add new tags.
How could I possibly do this? Alternatively, any different GUI suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能将小部件 (
GtkWidget
) 放入树视图的列中。但是您可以将多个单元格 (GtkCellRenderer
) 打包到单个列中。单元格渲染器有点像一个轻量级的小部件。它当然可以被子类化,因此如果没有其他东西适合您的需要,您可以编写自己的子类。You cannot put widgets (
GtkWidget
) inside a column of a treeview. But you can pack several cells (GtkCellRendenderer
) into a single column. A cell renderer is kind of like a lightweight widget. It can of course be subclassed so you can write your own if nothing else fits your needs.