UWidgetTree

The widget tree manages the collection of widgets in a blueprint widget.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

UMG

Header

/Engine/Source/Runtime/UMG/Public/Blueprint/WidgetTree.h

Include

#include "Blueprint/WidgetTree.h"

Syntax

class UWidgetTree : public UObject

Remarks

The widget tree manages the collection of widgets in a blueprint widget.

Variables

Name Description

Protected variable

TArray< UWidget...

 

AllWidgets

Public variable

UWidget *

 

RootWidget

The root widget of the tree

Constructors

Name Description

Public function

UWidgetTree

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

WidgetT *...

 

ConstructWidget

(
    TSubclassOf< UWidget > WidgetClass,
    FName WidgetName
)

Constructs the widget, and adds it to the tree.

Public function Static

int32

 

FindChildIndex

(
    const UPanelWidget* ParentWidg...,
    const UWidget* ChildWidget
)

Determines the child index of the given ParentWidget that the given ChildWidget ultimately occupies, accounting for nesting

Public function Const

UWidget *...

 

FindWidget

(
    const FName& Name
)

Finds the widget in the tree by name.

Public function Const

UWidget *...

 

FindWidget

(
    TSharedRef< SWidget > InWidget
)

Finds a widget in the tree using the native widget as the key.

Public function Const

WidgetT *...

 

FindWidget

(
    const FName& Name
)

Finds the widget in the tree by name and casts the return to the desired type.

Public function Static

UWidget *...

 

FindWidgetChild

(
    UPanelWidget* ParentWidget,
    FName ChildWidgetName,
    int32& OutChildIndex
)

Searches recursively through the children of the given ParentWidget to find a child widget of the given name.

Public function Static

UPanelWidget...

 

FindWidgetParent

(
    UWidget* Widget,
    int32& OutChildIndex
)

Gets the parent widget of a given widget, and potentially the child index.

Public function Const

void

 

ForEachWidget

(
    TFunctionRef< void*)> ...
)

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.

Public function Const

void

 

ForEachWidgetAndDescendants

(
    TFunctionRef< void*)> ...
)

Iterates through all widgets including widgets contained in named slots, other than investigating named slots.

Public function Static

void

 

ForWidgetAndChildren

(
    UWidget* Widget,
    TFunctionRef< void*)> ...
)

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.

Public function Const

void

 

GetAllWidgets

(
    TArray< UWidget* >& Widgets
)

Gathers all the widgets in the tree recursively

Public function Static

void

 

GetChildWidgets

(
    UWidget* Parent,
    TArray< UWidget* >& Widgets
)

Gathers descendant child widgets of a parent widget.

Public function Virtual Const

UWorld *

 

GetWorld()

Begin UObject.

Public function

bool

 

RemoveWidget

(
    UWidget* Widget
)

Removes the widget from the hierarchy and all sub widgets.

Public function Static

bool

 

TryMoveWidgetToNewTree

(
    UWidget* Widget,
    UWidgetTree* DestinationTree
)

Attempts to move a constructed Widget to another tree. Returns true on a successful move.

Overridden from UObject

Name Description

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

PreSave

(
    const ITargetPlatform* TargetP...
)

Presave function.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss