I've found the missing clue in another project: apparently the
inheritance order was wrong, it should be
class DerivedModel : public Gtk::TreeModel, public Glib::Object
and the constructor:
DerivedModel::DerivedModel() : Glib::ObjectBase("DerivedModel") {}
On 26.12.2017 14:50, Sandro Mani wrote:
Hi
I'm trying to create a derived Gtk::TreeModel, currently my attempt
boils down to
----
class DerivedModel : public Glib::Object, public Gtk::TreeModel {
public:
DerivedModel() {}
private:
Gtk::TreeModelFlags get_flags_vfunc() const override;
GType get_column_type_vfunc(int index) const override;
int get_n_columns_vfunc() const override;
bool iter_next_vfunc(const iterator& iter, iterator& iter_next)
const override;
bool get_iter_vfunc(const Path& path, iterator& iter) const override;
bool iter_children_vfunc(const iterator& parent, iterator& iter)
const override;
bool iter_parent_vfunc(const iterator& child, iterator& iter)
const override;
bool iter_nth_child_vfunc(const iterator& parent, int n, iterator&
iter) const override;
bool iter_nth_root_child_vfunc(int n, iterator& iter) const override;
bool iter_has_child_vfunc(const iterator& iter) const override;
int iter_n_children_vfunc(const iterator& iter) const override;
int iter_n_root_children_vfunc() const override;
Gtk::TreeModel::Path get_path_vfunc(const iterator& iter) const
override;
void set_value_impl(const iterator& row, int column, const
Glib::ValueBase& value) override;
void get_value_impl(const iterator& row, int column,
Glib::ValueBase& value) const override;
};
----
but using it in a Gtk::TreeView results in
gtk_tree_view_set_model: assertion 'model == NULL || GTK_IS_TREE_MODEL
(model)'
I suppose I missed some aspect of the GType registration of my derived
model... Any pointers?
Thanks
Sandro
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list