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" },
                ]
            }
        ]
    }
}