So I am assuming that you are looking for a discussion and not for a specific problem to be solved. If this is not the case, please post the code that is not working for you, delete my email and forgive me.

On 12/18/2018 01:01 PM, Adam Tauno Williams wrote:
I have created, and registered, a custom GObject type [an object].  I
can place that type into a ListModel: aka model =

One of the advantages of creating a GObject is the whole property
system - - - and most notably change signals.
And how exactly does that improve on the /model.connect("row-changed")/, and the signal family already in place?

What I have not been able to find is how to connect/map something like
a Gtk.CellRendererText to a property, such that having a type in a
model has some advantage [vs. a model like (int, str, str)].  ???
For myself, I use Glade for all the Treeviews I can as I would rather see the Treeview I build than try to memorize the construction of code. My few attempts in trying to subclass Treeview components got more messy than just hooking into their signal system and tweaking the data as it goes from point A to point B.

In the case I have in mind, I was trying to add a autocomplete feature to a Gtk.CellRendererCombo. I finally discovered that Gtk already has a provision for that by providing a /editing-started/ signal to add the autocomplete object to the entry inside the combo.

With that said, I have tens of Treeviews in my accounting system, and am always on the lookout for more fluent/better ways of showing data.

One other case worth mentioning was trying to get a Decimal column to play nicely in a Treeview (floats are not acceptable in accounting). I could use a PyObject type and display it using cell renderer display functions. However, when filtering and sorting, all manner of extra code had to be added to work with the Decimals. In the end it was faster and easier to use a two column approach, a /str/ for display and an /float/ for sorting. Then all the calculations are done in SQL, server side.

gtk-app-devel-list mailing list

Reply via email to