Gtk.SliceListModel¶
class — extends GObject.Object, Gio.ListModel, SectionModel
A list model that presents a slice of another model.
This is useful when implementing paging by setting the size to the number of elements per page and updating the offset whenever a different page is opened.
GtkSliceListModel passes through sections from the underlying model.
Constructors¶
new¶
Creates a new slice model.
It presents the slice from offset to offset + size
of the given model.
Parameters:
model— The model to useoffset— the offset of the slicesize— maximum size of the slice
Methods¶
get_model¶
Gets the model that is currently being used or None if none.
get_offset¶
Gets the offset set via SliceListModel.set_offset.
get_size¶
Gets the size set via SliceListModel.set_size.
set_model¶
Sets the model to show a slice of.
The model's item type must conform to self's item type.
Parameters:
model— The model to be sliced
set_offset¶
Sets the offset into the original model for this slice.
If the offset is too large for the sliced model,
self will end up empty.
Parameters:
offset— the new offset to use
set_size¶
Sets the maximum size. self will never have more items
than size.
It can however have fewer items if the offset is too large or the model sliced from doesn't have enough items.
Parameters:
size— the maximum size
Properties¶
item_type¶
The type of items. See Gio.ListModel.get_item_type.
model¶
Child model to take slice from.
n_items¶
The number of items. See Gio.ListModel.get_n_items.
offset¶
Offset of slice.
size¶
Maximum size of slice.