Deriving from Gtk::ListStore


say I want to derive my own model MyModel from Gtk::ListStore.
Now this brings a couple of issues which aren't covered in the documentation.

[At this point let me say, you're doing a great job on this library and I 
really appreciate that, but the documentation is extremely lacking. Topics 
like problems arising from deriving own widgets or even substantial things 
like event handling are incomplete or not covered at all. When reading 
through the documentation I have the impression it only scratches the surface 
of a pretty complex GUI library, and unfortunately I have been proved right 
so far. The examples are too trivial to be helpful and in some cases even 
wrong. The zillions of typedefs used in functions don't make life easier].

The problem is, that the model has to be instantiated using ListStore::create. 
Unfortunately this returns a Glib::RefPtr to a ListStore object, and not to 
an object of my derived type. Casting or using MyModel::create didn't help.
I have the impression that the MyModel specific parts are never initialized, 
since ListStore::create only seems to initialize the base class part.
This results in my program throwing "segmentation fault" errors at me when I 
want to use my model.

Well, I could try to explicitly create an instance of MyModel the standard 
way. Unfortunately e.g. TreeView::set_model expects a Glib:RefPtr, so my 
object is pretty useless because I can't pass it to that function.
There seems to be no way to let a RefPtr point to my object either.

So, what is the right approach to derive and create own models in gtkmm?

Thanks in advance,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]