Skip to content

Instantly share code, notes, and snippets.

@hulefei
Created March 17, 2022 02:30
Show Gist options
  • Save hulefei/f20f175cd50661495f9ecf78571ab17b to your computer and use it in GitHub Desktop.
Save hulefei/f20f175cd50661495f9ecf78571ab17b to your computer and use it in GitHub Desktop.
UE4 添加Tab
void FGCExampleModule::StartupModule() {
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(GCExampleTabName,
FOnSpawnTab::CreateRaw(this, &FGCExampleModule::OnSpawnPluginTab))
.SetDisplayName(LOCTEXT("FGCExampleTabTitle", "GCExample"))
.SetMenuType(ETabSpawnerMenuType::Hidden);
}
void FGCExampleModule::PluginButtonClicked()
{
FGlobalTabmanager::Get()->TryInvokeTab(GCExampleTabName);
}
TSharedRef<SDockTab> FGCExampleModule::OnSpawnPluginTab(const FSpawnTabArgs& SpawnTabArgs)
{
FText WidgetText = FText::Format(
LOCTEXT("WindowWidgetText", "Add code to {0} in {1} to override this window's contents"),
FText::FromString(TEXT("FGCExampleModule::OnSpawnPluginTab")),
FText::FromString(TEXT("GCExample.cpp"))
);
return SNew(SDockTab)
.TabRole(ETabRole::NomadTab)
[
// Put your tab content here!
// SNew(SBox)
// .HAlign(HAlign_Center)
// .VAlign(VAlign_Center)
// [
// SNew(STextBlock)
// .Text(WidgetText)
// ]
SNew(SGCWidget)
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment