Gtk.SectionModel¶
- Implementations:
Gtk.FilterListModel
,Gtk.FlattenListModel
,Gtk.MapListModel
,Gtk.MultiSelection
,Gtk.NoSelection
,Gtk.SingleSelection
,Gtk.SliceListModel
,Gtk.SortListModel
Methods¶
|
|
|
Virtual Methods¶
|
Properties¶
None
Signals¶
Name |
Short Description |
---|---|
Emitted when the start-of-section state of some of the items in model changes. |
Fields¶
None
Class Details¶
- class Gtk.SectionModel¶
- Bases:
- Structure:
GtkSectionModel
is an interface that adds support for sections to list models.A
GtkSectionModel
groups successive items into so-called sections. List widgets likeGtkListView
andGtkGridView
then allow displaying section headers for these sections by installing a header factory.Many GTK list models support sections inherently, or they pass through the sections of a model they are wrapping.
When the section groupings of a model change, the model will emit the [signal`Gtk`.SectionModel::sections-changed] signal by calling the [method`Gtk`.SectionModel.sections_changed] function. All sections in the given range then need to be queried again. The [signal`Gio`.ListModel::items-changed] signal has the same effect, all sections in that range are invalidated, too.
New in version 4.12.
- get_section(position)[source]¶
- Parameters:
position (
int
) – the position of the item to query- Returns:
- out_start:
the position of the first item in the section
- out_end:
the position of the first item not part of the section anymore.
- Return type:
Query the section that covers the given position. The number of items in the section can be computed by
out_end - out_start
.If the position is larger than the number of items, a single range from n_items to
GObject.G_MAXUINT
will be returned.New in version 4.12.
- do_get_section(position) virtual¶
- Parameters:
position (
int
) – the position of the item to query- Returns:
- out_start:
the position of the first item in the section
- out_end:
the position of the first item not part of the section anymore.
- Return type:
Query the section that covers the given position. The number of items in the section can be computed by
out_end - out_start
.If the position is larger than the number of items, a single range from n_items to
GObject.G_MAXUINT
will be returned.New in version 4.12.
Signal Details¶
- Gtk.SectionModel.signals.sections_changed(section_model, position, n_items)¶
- Signal Name:
sections-changed
- Flags:
- Parameters:
section_model (
Gtk.SectionModel
) – The object which received the signalposition (
int
) – The first item that may have changedn_items (
int
) – number of items with changes
Emitted when the start-of-section state of some of the items in model changes.
Note that this signal does not specify the new section state of the items, they need to be queried manually. It is also not necessary for a model to change the section state of any of the items in the section model, though it would be rather useless to emit such a signal.
The [signal`Gio`.ListModel::items-changed] implies the effect of the [signal`Gtk`.SectionModel::sections-changed] signal for all the items it covers.
New in version 4.12.