Ue4_动态创建子控件
如何在c++中创建子控件并设置对齐方式(Padding/Size)
在c++中设置Padding/Size
ULoadingSlot* LoadingSlot = CreateWidget<ULoadingSlot>(HBoxItemList, MapSlotClass); if (LoadingSlot) { LoadingSlot->InitInfo(LoadingDatas[i]); if (HBoxItemList) { HBoxItemList->AddChild(LoadingSlot); }
//转换为 UHorizontalBoxSlot *HSlot = Cast<UHorizontalBoxSlot>(LoadingSlot->Slot); if (HSlot) {
//可以设置Padding/Size HSlot->SetSize(FSlateChildSize(ESlateSizeRule::Fill)); } }