mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 21:04:47 +00:00
1.4 KiB
1.4 KiB
StandardListView
Like ListView, but with a default delegate, and a model
property which is a model of type
StandardListViewItem
.
Properties
Same as ListView
, and in addition:
current-item
(in-out int): The index of the currently active item. -1 mean none is selected, which is the defaultmodel
(inStandardListViewItem
): The model
Functions
set-current-item(_index: int_)
: Sets the current item and brings it into view
Callbacks
current-item-changed(
int
)
: Emitted when the current item has changed because the user modified ititem-pointer-event(
index: int
,
event: PointerEvent
,
pos: 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.
Example
import { StandardListView } from "std-widgets.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" },
];
}
}