Navigation
API > API/Runtime > API/Runtime/UMG
The widget tree manages the collection of widgets in a blueprint widget.
| Name | UWidgetTree |
| Type | class |
| Header File | /Engine/Source/Runtime/UMG/Public/Blueprint/WidgetTree.h |
| Include Path | #include "Blueprint/WidgetTree.h" |
Syntax
UCLASS (MinimalAPI)
class UWidgetTree :
public UObject ,
public INamedSlotInterface
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UWidgetTree
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UWidgetTree
(
const FObjectInitializer& ObjectInitializer |
Blueprint/WidgetTree.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| NamedSlotBindings | TMap< FName, TObjectPtr< UWidget > > | Stores the widgets being assigned to named slots, these widgets will be slotted into the named slots of the user widget that owns this widget tree after the user widget is constructed. | Blueprint/WidgetTree.h | |
| RootWidget | TObjectPtr< UWidget > | The root widget of the tree | Blueprint/WidgetTree.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
WidgetT * ConstructWidget
(
TSubclassOf< WidgetT > WidgetClass, |
Constructs the widget, and adds it to the tree. | Blueprint/WidgetTree.h | |
UWidget * FindWidget
(
const FName& Name |
Finds the widget in the tree by name. | Blueprint/WidgetTree.h | |
UWidget * FindWidget
(
TSharedRef< SWidget > InWidget |
Finds a widget in the tree using the native widget as the key. | Blueprint/WidgetTree.h | |
WidgetT * FindWidget
(
const FName& Name |
Finds the widget in the tree by name and casts the return to the desired type. | Blueprint/WidgetTree.h | |
void ForEachWidget
(
TFunctionRef< void(UWidget*)> Predicate |
Iterates through all widgets including widgets contained in named slots, other than investigating named slots, this code does not dive into foreign WidgetTrees, as would exist inside another user widget. | Blueprint/WidgetTree.h | |
void ForEachWidgetAndDescendants
(
TFunctionRef< void(UWidget*)> Predicate |
Iterates through all widgets including widgets contained in named slots, other than investigating named slots. | Blueprint/WidgetTree.h | |
void ForEachWidgetUntil
(
TFunctionRef< bool(UWidget*)> Predicate |
Iterates widgets according to ForEachWidget until Predicate returns false. | Blueprint/WidgetTree.h | |
| Gathers all the widgets in the tree recursively | Blueprint/WidgetTree.h | ||
virtual UWorld * GetWorld() |
Begin UObject. | Blueprint/WidgetTree.h | |
bool RemoveWidget
(
UWidget* Widget |
Removes the widget from the hierarchy and all sub widgets. | Blueprint/WidgetTree.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostLoad() |
Blueprint/WidgetTree.h | ||
virtual void PreSave
(
FObjectPreSaveContext ObjectSaveContext |
Blueprint/WidgetTree.h |
Overridden from INamedSlotInterface
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Gets the widget for a given slot by name, will return nullptr if no widget is in the slot. | Blueprint/WidgetTree.h | ||
| Gets the names for slots that we can store widgets into. | Blueprint/WidgetTree.h | ||
| Sets the widget for a given slot by name. | Blueprint/WidgetTree.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static int32 FindChildIndex
(
const UPanelWidget* ParentWidget, |
Determines the child index of the given ParentWidget that the given ChildWidget ultimately occupies, accounting for nesting | Blueprint/WidgetTree.h | |
static UWidget * FindWidgetChild
(
UPanelWidget* ParentWidget, |
Searches recursively through the children of the given ParentWidget to find a child widget of the given name. | Blueprint/WidgetTree.h | |
static UPanelWidget * FindWidgetParent
(
UWidget* Widget, |
Gets the parent widget of a given widget, and potentially the child index. | Blueprint/WidgetTree.h | |
static bool ForEachWidgetAndChildrenUntil
(
UWidget* Widget, |
Iterates widgets according to ForWidgetAndChildren until Predicate returns false. | Blueprint/WidgetTree.h | |
static void ForWidgetAndChildren
(
UWidget* Widget, |
Iterates through all child widgets including widgets contained in named slots, other than investigating named slots, this code does not dive into foreign WidgetTrees, as would exist inside another user widget. | Blueprint/WidgetTree.h | |
| Gathers descendant child widgets of a parent widget. | Blueprint/WidgetTree.h | ||
static bool TryMoveWidgetToNewTree
(
UWidget* Widget, |
Attempts to move a constructed Widget to another tree. Returns true on a successful move. | Blueprint/WidgetTree.h |