ColumnViewColumn#

class ColumnViewColumn(**properties: Any)#

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 GtkColumnViewColumn that uses the given factory for mapping items to widgets.

You most likely want to call append_column next.

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 self has not been added to a column view yet, None is returned.

get_expand() bool#

Returns whether this column should expand.

get_factory() ListItemFactory | None#

Gets the factory that’s currently used to populate list items for this column.

get_fixed_width() int#

Gets the fixed width of the column.

get_header_menu() MenuModel | None#

Gets the menu model that is used to create the context menu for the column header.

get_id() str | None#

Returns the ID set with set_id().

Added in version 4.10.

get_resizable() bool#

Returns whether this column is resizable.

get_sorter() Sorter | None#

Returns the sorter that is associated with the column.

get_title() str | None#

Returns the title set with set_title().

get_visible() bool#

Returns whether this column is visible.

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:

expandTrue if this column should expand to fill available sace

set_factory(factory: ListItemFactory | None = None) None#

Sets the GtkListItemFactory to use for populating list items for this column.

Parameters:

factory – the factory to use

set_fixed_width(fixed_width: int) None#

If fixed_width is not -1, sets the fixed width of column; 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

set_header_menu(menu: MenuModel | None = None) None#

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 sorter is None, 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_sorter for the necessary steps for setting up customizable sorting for ColumnView.

Parameters:

sorter – the GtkSorter to associate with column

set_title(title: str | None = None) None#

Sets the title of this column.

The title is displayed in the header of a GtkColumnView for this column and is therefore user-facing text that should be translated.

Parameters:

title – Title to use for this column

set_visible(visible: bool) None#

Sets whether this column should be visible in views.

Parameters:

visible – whether this column should be visible

Properties#

class ColumnViewColumn
props.column_view: ColumnView#

The type of the None singleton.

props.expand: bool#

The type of the None singleton.

props.factory: ListItemFactory#

The type of the None singleton.

props.fixed_width: int#

The type of the None singleton.

props.header_menu: MenuModel#

The type of the None singleton.

props.id: str#

The type of the None singleton.

Added in version 4.10.

props.resizable: bool#

The type of the None singleton.

props.sorter: Sorter#

The type of the None singleton.

props.title: str#

The type of the None singleton.

props.visible: bool#

The type of the None singleton.