Gtk.TreeListModel¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r |
|||
r/en |
|||
r |
|||
r/w/co/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.TreeListModel(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GtkTreeListModel
is a list model that can create child models on demand.- classmethod new(root, passthrough, autoexpand, create_func, *user_data)[source]¶
- Parameters:
root (
Gio.ListModel
) – TheGListModel
to use as rootpassthrough (
bool
) –True
to pass through items from the modelsautoexpand (
bool
) –True
to set the autoexpand property and expand the root modelcreate_func (
Gtk.TreeListModelCreateModelFunc
) – Function to call to create theGListModel
for the children of an item
- Returns:
a newly created
GtkTreeListModel
.- Return type:
Creates a new empty
GtkTreeListModel
displaying root with all rows collapsed.
- get_autoexpand()[source]¶
-
Gets whether the model is set to automatically expand new rows that get added.
This can be either rows added by changes to the underlying models or via [method`Gtk`.TreeListRow.set_expanded].
- get_child_row(position)[source]¶
- Parameters:
position (
int
) – position of the child to get- Returns:
the child in position
- Return type:
Gets the row item corresponding to the child at index position for self's root model.
If position is greater than the number of children in the root model,
None
is returned.Do not confuse this function with [method`Gtk`.TreeListModel.get_row].
- get_model()[source]¶
- Returns:
the root model
- Return type:
Gets the root model that self was created with.
- get_passthrough()[source]¶
-
Gets whether the model is passing through original row items.
If this function returns
False
, theGListModel
functions for self return customGtkTreeListRow
objects. You need to call [method`Gtk`.TreeListRow.get_item] on these objects to get the original item.If
True
, the values of the child models are passed through in their original state. You then need to call [method`Gtk`.TreeListModel.get_row] to get the custom ``GtkTreeListRow``s.
- get_row(position)[source]¶
- Parameters:
position (
int
) – the position of the row to fetch- Returns:
The row item
- Return type:
Gets the row object for the given row.
If position is greater than the number of items in self,
None
is returned.The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current item as long as the row is present in self, independent of other rows being added or removed.
If self is set to not be passthrough, this function is equivalent to calling
Gio.ListModel.get_item
().Do not confuse this function with [method`Gtk`.TreeListModel.get_child_row].
Property Details¶
- Gtk.TreeListModel.props.autoexpand¶
- Name:
autoexpand
- Type:
- Default Value:
- Flags:
If all rows should be expanded by default.
- Gtk.TreeListModel.props.item_type¶
- Name:
item-type
- Type:
- Default Value:
<GType GObject>
- Flags:
The type of items. See [method`Gio`.ListModel.get_item_type].
New in version 4.8.
- Gtk.TreeListModel.props.model¶
- Name:
model
- Type:
- Default Value:
- Flags:
The root model displayed.
- Gtk.TreeListModel.props.n_items¶
-
The number of items. See [method`Gio`.ListModel.get_n_items].
New in version 4.8.