ColumnView with TreeListModel: Is it possible to autoexpand model at only top level

I have a ColumnView backed by a TreeListModel with three levels, but would like to only expand the topmost level automatically. Unfortunately I can find no way to do this.

I tried calling gtk_tree_list_row_set_expanded in the bind function call back of the first column’s SignalListItemFactory but this caused the system to crash with SIGSEGV. I can’t find any other point where the TreeListRow is accessible via code.

My basic Model set up is (once again, apologies for the Rust code :slight_smile: )

            let model = TreeListModel::new(plan_object, false, true, |object| {
                if object.is::<SectorObject>() {
                    let s = object.downcast_ref::<SectorObject>().expect("Sector Object");
                    let so = s.clone();
                    Some(so.upcast::<ListModel>())
                } else if object.is::<WaypointObject>() {
                    let wp = object.downcast_ref::<WaypointObject>().expect("Waypoint Object");
                    let wpo = wp.clone();
                    Some(wpo.upcast::<ListModel>())
                } else {
                    None
                }
            });

Where both SectorObject and WaypointObject implement ListModel.

With autoexpand set to “false” adding

                    if row.is_expandable() {
                        row.set_expanded(true);
                    }

to the bind callback of the first TreeViewColumn causes

(kelpie_rust_planner:32871): Gtk-CRITICAL **: 10:32:14.950: gtk_widget_insert_after: assertion 'previous_sibling == NULL || _gtk_widget_get_parent (previous_sibling) == parent' failed

Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.