Navigation
API > API/Runtime > API/Runtime/Slate
A ListView widget observes an array of data items and creates visual representations of these items. ListView relies on the property that holding a reference to a value ensures its existence. In other words, neither SListView
A trivial use case appear below:
Given: TArray< TSharedPtr
SNew( SListView< TSharedPtr
The ListView will create widgets based on data items in the Items TArray. When the ListView needs to generate an item, it will do so using the specified OnGenerateRow method.
A sample implementation of MyClass::GenerateItemRow has to return a STableRow with optional content:
TSharedRef
| Name | SListView |
| Type | class |
| Header File | /Engine/Source/Runtime/Slate/Public/Widgets/Views/SListView.h |
| Include Path | #include "Widgets/Views/SListView.h" |
Syntax
template<typename ItemType>
class SListView :
public STableViewBase ,
private TListTypeTraits< T, Enable >::SerializerType,
public ITypedTableView< ItemType >
Inheritance Hierarchy
- FSharedFromThisBase → TSharedFromThis → SWidget → SCompoundWidget → STableViewBase → SListView
- FSlateControlledConstruction → SWidget → SCompoundWidget → STableViewBase → SListView
- TListTypeTraits< T, Enable >::SerializerType → SListView
- SListView
Implements Interfaces
Derived Classes
SListView derived class hierarchy
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
PRAGMA_DISABLE_DEPRECATION_WARNINGS SListView
(
ETableViewMode::Type InListMode |
Widgets/Views/SListView.h |
Classes
| Name | Remarks |
|---|---|
| FSlateAccessibleListView | An accessible implementation for SListView to be exposed to platform accessibility APIs. |
| FWidgetGenerator | A WidgetGenerator is a component responsible for creating widgets from data items. |
| SListViewPinnedRowWidget | Private class that acts as a wrapper around PinnedRows, to allow for customized styling. |
Structs
| Name | Remarks |
|---|---|
| FArguments | |
| FGenerationPassGuard |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FIsSelectableOrNavigable | typename TSlateDelegates< ItemType >::FIsSelectableOrNavigable | Widgets/Views/SListView.h | |
| FOnEntryInitialized | TBaseDelegate_TwoParams< void, ItemType, const TSharedRef< ITableRow > & > | Widgets/Views/SListView.h | |
| FOnGenerateRow | typename TSlateDelegates< ItemType >::FOnGenerateRow | Widgets/Views/SListView.h | |
| FOnItemScrolledIntoView | typename TSlateDelegates< ItemType >::FOnItemScrolledIntoView | Widgets/Views/SListView.h | |
| FOnItemToString_Debug | TSlateDelegates< ItemType >::FOnItemToString_Debug | Widgets/Views/SListView.h | |
| FOnMouseButtonClick | typename TSlateDelegates< ItemType >::FOnMouseButtonClick | Widgets/Views/SListView.h | |
| FOnMouseButtonDoubleClick | typename TSlateDelegates< ItemType >::FOnMouseButtonDoubleClick | Widgets/Views/SListView.h | |
| FOnRefreshRow | typename TSlateDelegates< ItemType >::FOnRefreshRow | Widgets/Views/SListView.h | |
| FOnSelectionChanged | typename TSlateDelegates< NullableItemType >::FOnSelectionChanged | Widgets/Views/SListView.h | |
| FOnWidgetToBeRemoved | TBaseDelegate_OneParam< void, const TSharedRef< ITableRow > & > | Widgets/Views/SListView.h | |
| MapKeyFuncs | typename TListTypeTraits< ItemType >::MapKeyFuncs | Widgets/Views/SListView.h | |
| MapKeyFuncsSparse | typename TListTypeTraits< ItemType >::MapKeyFuncsSparse | Widgets/Views/SListView.h | |
| NullableItemType | typename TListTypeTraits< ItemType >::NullableType | Widgets/Views/SListView.h | |
| TItemSet | TSet< TObjectPtrWrapTypeOf< ItemType >, typename TListTypeTraits< TObjectPtrWrapTypeOf< ItemType > >::SetKeyFuncs > | Widgets/Views/SListView.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ViewSource | TUniquePtr< UE::Slate::ItemsSource::IItemsSource< ItemType > > | Pointer to the source data that we are observing | Widgets/Views/SListView.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AddReferencedObjects
(
FReferenceCollector& Collector |
Lists and Trees serialize items that they observe because they rely on the property that holding a reference means it will not be garbage collected. | Widgets/Views/SListView.h | |
void BindToRefreshRow
(
const FOnRefreshRow& Binding |
Widgets/Views/SListView.h | ||
void CancelScrollIntoView() |
Cancels a previous request to scroll an item into view (cancels navigation requests as well). | Widgets/Views/SListView.h | |
void ClearHighlightedItems() |
Empty the highlighted item set. | Widgets/Views/SListView.h | |
void ClearItemsSource() |
Widgets/Views/SListView.h | ||
void ClearSelection() |
Empty the selection set. | Widgets/Views/SListView.h | |
void Construct
(
const typename SListView< ItemType >::FArguments& InArgs |
Construct this widget | Widgets/Views/SListView.h | |
virtual TSharedRef< ITableRow > GenerateNewPinnedWidget
(
ItemType InItem, |
Widgets/Views/SListView.h | ||
virtual TSharedRef< ITableRow > GenerateNewWidget
(
ItemType InItem |
Given an data item, generate a widget corresponding to it. | Widgets/Views/SListView.h | |
void GeneratePinnedWidgetForItem
(
const ItemType& CurItem, |
Widgets/Views/SListView.h | ||
float GenerateWidgetForItem
(
const ItemType& CurItem, |
Widgets/Views/SListView.h | ||
TArrayView< const ItemType > GetItems() |
Widgets/Views/SListView.h | ||
FVector2D GetMaxRowSizeForColumn
(
const FName& ColumnId, |
Will determine the max row size for the specified column id | Widgets/Views/SListView.h | |
int32 GetNumItemsSelected() |
Gets the number of selected items. | Widgets/Views/SListView.h | |
virtual FString GetReferencerName() |
Widgets/Views/SListView.h | ||
int32 GetSelectedItems
(
TArray< ItemType >& SelectedItemArray |
Widgets/Views/SListView.h | ||
bool HasValidItemsSource() |
Widgets/Views/SListView.h | ||
bool IsItemSelected
(
const ItemType& InItem |
Test if the current item is selected. | Widgets/Views/SListView.h | |
bool IsItemVisible
(
ItemType Item |
Checks whether the specified item is currently visible in the list view. | Widgets/Views/SListView.h | |
const TObjectPtrWrapTypeOf< ItemType > * ItemFromWidget
(
const ITableRow* WidgetToFind |
Given a Widget, find the corresponding data item. | Widgets/Views/SListView.h | |
void Private_OnEntryInitialized
(
ItemType TheItem, |
A low-level interface for use various widgets generated by ItemsWidgets(Lists, Trees, etc). | Widgets/Views/SListView.h | |
| Widgets/Views/SListView.h | |||
void RequestNavigateToItem
(
ItemType Item, |
Navigate to a specific item, scrolling it into view if needed. | Widgets/Views/SListView.h | |
void RequestScrollIntoView
(
ItemType ItemToView, |
Widgets/Views/SListView.h | ||
void RequestScrollIntoView
(
ItemType ItemToView, |
Scroll an item into view. If the item is not found, fails silently. | Widgets/Views/SListView.h | |
void SetItemHighlighted
(
const ItemType& TheItem, |
Set the highlighted state of an item. | Widgets/Views/SListView.h | |
void SetItemSelection
(
TConstArrayView< ItemType > InItems, |
Set the selection state of multiple items. | Widgets/Views/SListView.h | |
void SetItemSelection
(
const ItemType& InItem, |
Set the selection state of an item. | Widgets/Views/SListView.h | |
void SetItemsSource
(
const TArray< ItemType >* InListItemsSource |
Establishes a wholly new list of items being observed by the list. | Widgets/Views/SListView.h | |
void SetItemsSource
(
TSharedRef<::UE::Slate::Containers::TObservableArray< ItemType > > InListItemsSource |
Establishes a wholly new list of items being observed by the list. | Widgets/Views/SListView.h | |
void SetItemsSource
(
TUniquePtr< UE::Slate::ItemsSource::IItemsSource< ItemType > > Provider |
Establishes a wholly new list of items being observed by the list. | Widgets/Views/SListView.h | |
void SetListItemsSource
(
const TArray< ItemType >& InListItemsSource |
Widgets/Views/SListView.h | ||
void SetOnEntryInitialized
(
const FOnEntryInitialized& Delegate |
Sets the OnEntryInitializer delegate. | Widgets/Views/SListView.h | |
void SetScrollIntoViewAlignment
(
EScrollIntoViewAlignment NewScrollIntoViewAlignment |
Sets ScrollIntoViewAlignment which allows to stick the selected item to either side or center | Widgets/Views/SListView.h | |
void SetSelection
(
ItemType SoleSelectedItem, |
Set the currently selected Item. | Widgets/Views/SListView.h | |
void SetSelectionMode
(
const TAttribute< ESelectionMode::Type >& NewSelectionMode |
Set the current selection mode of the list. | Widgets/Views/SListView.h | |
void SetShadowBoxStyle
(
const FScrollBoxStyle* InScrollBoxStyle |
Widgets/Views/SListView.h | ||
void SetStyle
(
const FTableViewStyle* InStyle |
Widgets/Views/SListView.h |
Overridden from STableViewBase
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual int32 GetNumItemsBeingObserved() |
Widgets/Views/SListView.h | ||
virtual void RebuildList() |
Completely wipe existing widgets and fully regenerate them on next tick. | Widgets/Views/SListView.h | |
virtual FReGenerateResults ReGenerateItems
(
const FGeometry& MyGeometry |
Update generate Widgets for Items as needed and clean up any Widgets that are no longer needed. | Widgets/Views/SListView.h | |
virtual void UpdateSelectionSet() |
Remove any items that are no longer in the list from the selection set. | Widgets/Views/SListView.h |
Overridden from SWidget
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TSharedRef< FSlateAccessibleWidget > CreateAccessibleWidget() |
Widgets/Views/SListView.h | ||
virtual TOptional< FText > GetDefaultAccessibleText
(
EAccessibleType AccessibleType |
Widgets/Views/SListView.h | ||
| Widgets/Views/SListView.h | |||
virtual FReply OnMouseButtonDown
(
const FGeometry& MyGeometry, |
Widgets/Views/SListView.h | ||
virtual FReply OnMouseButtonUp
(
const FGeometry& MyGeometry, |
Widgets/Views/SListView.h | ||
virtual FNavigationReply OnNavigation
(
const FGeometry& MyGeometry, |
Widgets/Views/SListView.h | ||
virtual bool SupportsKeyboardFocus() |
Widgets/Views/SListView.h |
Overridden from ITypedTableView
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual TSharedRef< SWidget > AsWidget() |
Widgets/Views/SListView.h | ||
virtual TArray< ItemType > GetSelectedItems () |
Returns a list of selected item indices, or an empty array if nothing is selected | Widgets/Views/SListView.h | |
virtual ETableViewMode::Type GetTableViewMode() |
Widgets/Views/SListView.h | ||
virtual void Private_ClearHighlightedItems() |
Empty the set of highlighted items. | Widgets/Views/SListView.h | |
virtual void Private_ClearSelection() |
Empty the selection set. | Widgets/Views/SListView.h | |
virtual bool Private_DoesItemHaveChildren
(
int32 ItemIndexInList |
Widgets/Views/SListView.h | ||
virtual int32 Private_GetNestingDepth
(
int32 ItemIndexInList |
Widgets/Views/SListView.h | ||
virtual int32 Private_GetNumSelectedItems() |
Widgets/Views/SListView.h | ||
virtual EOrientation Private_GetOrientation() |
Widgets/Views/SListView.h | ||
virtual ESelectionMode::Type Private_GetSelectionMode() |
Widgets/Views/SListView.h | ||
virtual const TBitArray & Private_GetWiresNeededByDepth
(
int32 ItemIndexInList |
Widgets/Views/SListView.h | ||
virtual bool Private_HasSelectorFocus
(
const ItemType& TheItem |
Test if the item passed in has selector focus. | Widgets/Views/SListView.h | |
virtual bool Private_IsItemExpanded
(
const ItemType& TheItem |
Widgets/Views/SListView.h | ||
virtual bool Private_IsItemHighlighted
(
const ItemType& TheItem |
Test if the current item should be highlighted. This is separate from hover highlights. | Widgets/Views/SListView.h | |
virtual bool Private_IsItemSelectableOrNavigable
(
const ItemType& TheItem |
Test if the current item can be selected or navigated to. | Widgets/Views/SListView.h | |
virtual bool Private_IsItemSelected
(
const ItemType& TheItem |
Test if the current item is selected. | Widgets/Views/SListView.h | |
virtual bool Private_IsLastChild
(
int32 ItemIndexInList |
Widgets/Views/SListView.h | ||
virtual bool Private_IsPendingRefresh() |
Is the list pending a refresh? | Widgets/Views/SListView.h | |
virtual const TObjectPtrWrapTypeOf< ItemType > * Private_ItemFromWidget
(
const ITableRow* TheWidget |
Given a Widget, find the corresponding data item. | Widgets/Views/SListView.h | |
virtual void Private_OnExpanderArrowShiftClicked
(
ItemType TheItem, |
Called when the expander arrow for the given item is shift+clicked. | Widgets/Views/SListView.h | |
virtual bool Private_OnItemClicked
(
ItemType TheItem |
Called when the item is clicked, and returns whether or not the event was handled | Widgets/Views/SListView.h | |
virtual bool Private_OnItemDoubleClicked
(
ItemType TheItem |
Called when the item is double-clicked, and returns whether or not the event was handled | Widgets/Views/SListView.h | |
virtual void Private_OnItemRightClicked
(
ItemType TheItem, |
Called when the item is right-clicked when not right mouse scrolling | Widgets/Views/SListView.h | |
virtual void Private_SelectRangeFromCurrentTo
(
ItemType SelectorItem |
Select a range of items from the current RangeSelectionStart to the SelectorItem Does not cause an OnSelectionChanged()! | Widgets/Views/SListView.h | |
virtual void Private_SetItemExpansion
(
ItemType TheItem, |
Set whether some data item is expanded or not. | Widgets/Views/SListView.h | |
virtual void Private_SetItemHighlighted
(
ItemType TheItem, |
Enable a soft highlight on the element. | Widgets/Views/SListView.h | |
virtual void Private_SetItemSelection
(
ItemType TheItem, |
Set the selection state of an item. Does not cause an OnSelectionChanged()! | Widgets/Views/SListView.h | |
virtual void Private_SignalSelectionChanged
(
ESelectInfo::Type SelectInfo |
Notify the ItemsWidget that we changed its selection. Triggers as OnSelectionChanged(). | Widgets/Views/SListView.h | |
virtual bool Private_UsesSelectorFocus() |
Returns whether the table view uses selector focus. | Widgets/Views/SListView.h | |
virtual TSharedPtr< ITableRow > WidgetFromItem
(
const ItemType& InItem |
Find a widget for this item if it has already been constructed. | Widgets/Views/SListView.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void NavigationSelect
(
const ItemType& InItemToSelect, |
Selects the specified item and scrolls it into view. | Widgets/Views/SListView.h | |
virtual void NavigationSelect
(
const ItemType& InItemToSelect, |
Special handling for navigation events | Widgets/Views/SListView.h | |
| Widgets/Views/SListView.h | |||
TOptional< ItemType > Private_FindNextSelectableOrNavigable
(
const ItemType& InItemToSelect |
Widgets/Views/SListView.h | ||
TOptional< ItemType > Private_FindNextSelectableOrNavigableWithIndexAndDirection
(
const ItemType& InItemToSelect, |
Widgets/Views/SListView.h |
Overridden from STableViewBase
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void NotifyFinishedScrolling () |
Called at the end of a Tick when | Widgets/Views/SListView.h | |
virtual void NotifyItemScrolledIntoView() |
Called when an item has entered the visible geometry to check to see if the ItemScrolledIntoView delegate should be fired. | Widgets/Views/SListView.h | |
virtual float ScrollBy
(
const FGeometry& MyGeometry, |
Scroll the list view by some number of screen units. | Widgets/Views/SListView.h | |
virtual EScrollIntoViewResult ScrollIntoView
(
const FGeometry& ListViewGeometry |
If there is a pending request to scroll an item into view, do so. | Widgets/Views/SListView.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static FOnItemToString_Debug GetDefaultDebugDelegate() |
Widgets/Views/SListView.h |