UWidgetTree

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

Windows
MacOS
Linux

Inheritance Hierarchy

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(UWidget*)> ...
)

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(UWidget*)> ...
)

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

Public function Static

void

 

ForWidgetAndChildren

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

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.

References

Module

UMG

Header

Runtime/UMG/Public/Blueprint/WidgetTree.h

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback