GroupListView

Like StandardListView with parent header items.

Properties

  • current_item (in_out { parent: int, item: int }): The index of the currently active item.
  • model (in [GroupListViewItem]): The model of items.
  • selection_mode (in SelectionMode): Defines the selection mode.
  • has_focus (out bool): True if the list view has focus.
  • enabled (in bool): True if the list view is enabled.

Functions

  • set_current_item(row: int, par-row: int): Sets the current item.

Callbacks

  • current_item_changed(/* index */ { parent: int, item: int }): Emitted when the current item has changed because the user modified it
  • item_pointer_event(int /* par_index */, int /* item_index */, PointerEvent /* event */, Point /* absolute mouse position */): Emitted on any mouse pointer event similar to TouchArea. Arguments are item index associated with the event, the PointerEvent itself and the mouse position within the listview.
  • key_pressed(/* event */ KeyEvent): Emitted when there is a key press event on the listview.

Example

import { GroupListView } from "@coop/lib.slint";

export component Example inherits Window {
    width: 150px;
    height: 150px;

    GroupListView {
        width: 150px;
        height: 150px;
        model: [
            {
                text: "Header 1",
                items: [
                    { text: "Item 1" },
                    { text: "Item 2" },
                    { text: "Item 3" },
                ]
            },
             {
                text: "Header 2",
                items: [
                    { text: "Item 1" },
                    { text: "Item 2" },
                    { text: "Item 3" },
                ]
            }
        ]
    }
}