//创建弹窗
int textureMappingWith = 700;
int textureMappingHeight = 500;
TSharedPtr<SWindow> textureMapping = SNew(SWindow)
.AutoCenter(EAutoCenter::PreferredWorkArea)
.Title(LOCTEXT("材质框", "材质框"))
.SizingRule(ESizingRule::FixedSize)
.SupportsMaximize(false)
.SupportsMinimize(false).HasCloseButton(true)
.ClientSize(FVector2D(textureMappingWith, textureMappingHeight))
.CreateTitleBar(false);
//创建弹窗内容
TSharedPtr< SWidget > content =
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.AutoHeight()
[
SNew(SBox)
.HeightOverride(20)
[
SNew(SWindowTitleBarArea)//窗口标题,可以将窗口随意拖动
.Content()
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.HAlign(HAlign_Right)
[
SNew(SButton)
.Text(LOCTEXT("CloseWindows", "X"))
.OnClicked(this, &FEditorModeTestEdModeToolkit::CloseWindows)
]
]
]
//SNew(SComboBox)
];
//将弹窗内容添加到弹框中
textureMapping->SetContent(content.ToSharedRef());
//显示弹窗
FSlateApplication::Get().AddWindow(textureMapping.ToSharedRef());