StandardListView
Like ListView, but with a default delegate, and a model
property which is a model of type
ListViewItem
.
Properties
current-item
(in_out int): The index of the currently active item. -1 mean none is selected, which is the defaultmodel
(in[ListViewItem]
): The model of items.selection-mode
(inSelectionMode
): Defines the selection mode.edit-item
(in int): Defines the item that is can be edited.has-focus
(out bool): True if the list view has focus.enabled
(in bool): True if the list view is enabled.drag-drop-enabled
(in bool): If set totrue
drop event is enabled.
Functions
set-current-item(index: int)
: Sets the current item by the specified index and brings it into view.bring-into-view(index: int)
: If the given item is outside of the current visible area the list view will be scrolled to ensure the item is visible.
Callbacks
current-item-changed(/* current-item */ int)
: Emitted when the current item has changed because the user modified ititem-pointer-event(/* index */ int, /* event */ PointerEvent, /* position */ Point)
: Emitted on any mouse pointer event similar toTouchArea
. Arguments are item index associated with the event, thePointerEvent
itself and the mouse position within the listview.item-accepted(/* index */ int, /* text */ string)
: Emitted when the text of the item is edited and after the enter is pressed.key-pressed(/* event */ KeyEvent)
: Emitted when there is a key press event on the list view.drop-event(/* event */
DropEvent)
: Emitted when a row is dropped on an other row.
Example
import { StandardListView } from "@coop/lib.slint";
export component Example inherits Window {
width: 150px;
height: 150px;
StandardListView {
width: 150px;
height: 150px;
model: [ { text: "Blue"}, { text: "Red" }, { text: "Green" },
{ text: "Yellow" }, { text: "Black"}, { text: "White"},
{ text: "Magenta" }, { text: "Cyan" },
];
}
}