Derived Gtk::TreeModel



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



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