Created
March 17, 2022 02:44
-
-
Save hulefei/1953ee6ef7766f4e830aea850875a7d1 to your computer and use it in GitHub Desktop.
UE4 创建 window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FReply SGCWidget::AddWindow() | |
{ | |
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")) | |
); | |
TSharedRef<SWindow> RenameWindow = SNew(SWindow) | |
.Title(LOCTEXT("DiscoveringAssetsDialog", "Discovering Assets...")) | |
.SizingRule( ESizingRule::Autosized ) | |
.SupportsMaximize(false) | |
.SupportsMinimize(false) | |
[ | |
SNew(SBox) | |
.HAlign(HAlign_Center) | |
.VAlign(VAlign_Center) | |
[ | |
SNew(STextBlock) | |
.Text(WidgetText) | |
] | |
]; | |
// IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame")); | |
// if ( MainFrameModule.GetParentWindow().IsValid() ) | |
// { | |
// FSlateApplication::Get().AddWindowAsNativeChild(RenameWindow, MainFrameModule.GetParentWindow().ToSharedRef()); | |
// } | |
// else | |
{ | |
FSlateApplication::Get().AddWindow(RenameWindow); | |
} | |
return FReply::Handled(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment