问题描述
我有一个带有已应用过滤器的 ListStore 的 treeView。 因此,树视图采用 TreeFilterModel 以便可以进行过滤。
# Create a tree for the driver paramenter list
# The data in the model (three strings for each row,one for each column
self.listmodel = Gtk.ListStore(str,str,str)
self.driver_filter = self.listmodel.filter_new()
self.driver_filter.set_visible_func(self.driver_filter_func)
# a treeview to see the data stored in the model
self.treeView = Gtk.TreeView(model=self.driver_filter)
select = self.treeView.get_selection()
select.connect("changed",self.on_tree_selection_changed)
# for each column
for i,column in enumerate(titles):
# cellrenderer to render the text
cell = Gtk.CellRendererText()
# the text in the first column should be in boldface
if i == 0:
cell.props.weight_set = True
cell.props.weight = Pango.Weight.BOLD
# the column is created
col = Gtk.TreeViewColumn(column,cell,text=i)
col.set_min_width(250)
if i == 2:
cell.set_property("editable",True)
cell.connect("edited",self.on_cell_edited)
# and it is appended to the treeview
self.treeView.append_column(col)
self.treeView.set_grid_lines(3)
...
当我选择一行时,我希望能够通过单击按钮将其删除。 但我不能这样做,因为它是一个 TreeFilterModel。 我无法移除过滤器,因为这是我的要求。
谁能帮助我并建议我如何删除 TreeFilterModel 中的一行?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)