我目前正在尝试TreeView
根据文本框的输入来过滤 a,同时仍然允许TreeView
用户编辑的单元格。
我遇到的问题是无法在TreeView
使用 时将编辑翻译TreeModelFilter
成对子模型的编辑,即ListStore
.
单元格 ( CellRendererText
) 编辑的 signal_connect 如下所示:
renderer.signal_connect('edited') do |w, s1, s2|
cell_edited(s1, s2, treeview, $status)
end
def cell_edited(path, str, trvu, cell)
if str != ""
iter = @store.get_iter(path)
iter[cell] = str
end
end
我承认这是我在 Gtk2 中搜索编辑 TreeViews 时发现的,因为我通常是 GTK2 和 GUI 新手。
如何将路径转换TreeViewFilter
为子模型(ListStore
)中的路径?
或者更简单地说:当用户在过滤后编辑表格中的单元格时,如何更新列表中正确的未过滤条目?