ColumnViewColumn#
Superclasses: Object
GtkColumnViewColumn represents the columns being added to a GtkColumnView.
The main ingredient for a GtkColumnViewColumn is the GtkListItemFactory
that tells the columnview how to create cells for this column from items in
the model.
Columns have a title, and can optionally have a header menu set
with set_header_menu.
A sorter can be associated with a column using
set_sorter, to let users influence sorting
by clicking on the column header.
Constructors#
- class ColumnViewColumn
- classmethod new(title: str | None = None, factory: ListItemFactory | None = None) ColumnViewColumn#
Creates a new
GtkColumnViewColumnthat uses the givenfactoryfor mapping items to widgets.You most likely want to call
append_columnnext.The function takes ownership of the argument, so you can write code like:
column = gtk_column_view_column_new (_("Name"), gtk_builder_list_item_factory_new_from_resource ("/name.ui"));
- Parameters:
title – Title to use for this column
factory – The factory to populate items with
Methods#
- class ColumnViewColumn
- get_column_view() ColumnView | None#
Gets the column view that’s currently displaying this column.
If
selfhas not been added to a column view yet,Noneis returned.
- get_factory() ListItemFactory | None#
Gets the factory that’s currently used to populate list items for this column.
Gets the menu model that is used to create the context menu for the column header.
- get_title() str | None#
Returns the title set with
set_title().
- set_expand(expand: bool) None#
Sets the column to take available extra space.
The extra space is shared equally amongst all columns that have the expand set to
True.- Parameters:
expand –
Trueif this column should expand to fill available sace
- set_factory(factory: ListItemFactory | None = None) None#
Sets the
GtkListItemFactoryto use for populating list items for this column.- Parameters:
factory – the factory to use
- set_fixed_width(fixed_width: int) None#
If
fixed_widthis not -1, sets the fixed width ofcolumn; otherwise unsets it.Setting a fixed width overrides the automatically calculated width. Interactive resizing also sets the “fixed-width” property.
- Parameters:
fixed_width – the new fixed width, or -1
Sets the menu model that is used to create the context menu for the column header.
- Parameters:
menu – a
GMenuModel
- set_id(id: str | None = None) None#
Sets the id of this column.
GTK makes no use of this, but applications can use it when storing column view configuration.
It is up to callers to ensure uniqueness of IDs.
Added in version 4.10.
- Parameters:
id – ID to use for this column
- set_resizable(resizable: bool) None#
Sets whether this column should be resizable by dragging.
- Parameters:
resizable – whether this column should be resizable
- set_sorter(sorter: Sorter | None = None) None#
Associates a sorter with the column.
If
sorterisNone, the column will not let users change the sorting by clicking on its header.This sorter can be made active by clicking on the column header, or by calling
sort_by_column.See
get_sorterfor the necessary steps for setting up customizable sorting forColumnView.- Parameters:
sorter – the
GtkSorterto associate withcolumn
Properties#
- class ColumnViewColumn
- props.column_view: ColumnView#
The type of the None singleton.
- props.factory: ListItemFactory#
The type of the None singleton.
The type of the None singleton.