Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I hide some rows in a TreeView?

Hide rows Treeview
0
10 Posted

How do I hide some rows in a TreeView?

0

To be able to hide some of the rows of a TreeView, you need to use a TreeModelFilter. This class acts as a wrapper for your TreeModel (a ListStore or TreeStore), allowing you to choose which rows are displayed based on the value of a gobject.TYPE_BOOLEAN column, or based on the output of a certain function. Keep in mind that this is only a wrapper, it does not implement the usual insertion or removing functions provided by ListStore or TreeStore. To do that, you need to access the model itself. Also, when you get an iter from your TreeView, it will point to the TreeModelFilter, so you need to make a translation into a useful iter, by calling convert_iter_to_child_iter(), and viceversa. The same goes for paths. Here is a working example of how to create a TreeModelFilter to hide some rows, and how to access the data after it’s been displayed.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.