Download

Any example of ListView widget?

cant found any docs and example about it

I also couldn’t find any info on how to do it

It’s pretty straightforward to make…
Good examples are from

SAssetView.cpp

Check for SAssetListView

return SNew(SAssetListView)
.SelectionMode( SelectionMode )
.ListItemsSource(&FilteredAssetItems)
.OnGenerateRow(this, &SAssetView::MakeListViewWidget)
.OnItemScrolledIntoView(this, &SAssetView::ItemScrolledIntoView)
.OnContextMenuOpening(this, &SAssetView::OnGetContextMenuContent)
.OnMouseButtonDoubleClick(this, &SAssetView::OnListMouseButtonDoubleClick)
.OnSelectionChanged(this, &SAssetView::AssetSelectionChanged)
.ItemHeight(this, &SAssetView::GetListViewItemHeight);

Some details

-ListItemsSource obtains the array of Assets (in this case already filtered)

  • OnGenerateRow is called to generate a TSharedRef which is the view that will be displayed on the ListView
  • ItemHeight sets the height, it’s a slate attribute, so you can set up a constant
  • OnContextMenuOpening is called when you right click, you can make a context menu here (default does nothing).

All others are not mandatory, but OnSelectionChanged is used when you click on the listview

There are more examples there, check it out