[UE4]Widget一些用法

ChildSlot
    [
        SNew(SVerticalBox)
        //-----------------------------//
        + SVerticalBox::Slot()
        [
            SNew(SHorizontalBox)
            + SHorizontalBox::Slot()
            [
                SNew(SBox)
                .HeightOverride(20.0f)
                .WidthOverride(60.0f)
                [
                    SNew(STextBlock)
                    .Text(LOCTEXT("TextDefaultValue0", "test:"))
                ]
            ]

            + SHorizontalBox::Slot()
            [
                SNew(SBox)
                .HeightOverride(30.0f)
                .WidthOverride(150.0f)
                [
                    SAssignNew(SplitMapBtn, SButton)
                    .OnClicked(this, &SEventTest::OnButtonClicked)
                    .Text(LOCTEXT("Split", "SplitMap"))
                ]
                
            ]

            + SHorizontalBox::Slot()
                [
                    SNew(SBox)
                    .AutoWidth()
                [
                    SNew(SCheckBox)
                .OnCheckStateChanged(this, &SEventTest::OnCheckBoxChanged)
                .ToolTipText(FText::FromString(TEXT("Sprays the blueprints when checked and mouse down.")))
                .IsChecked(this, &SEventTest::OnCheckBoxActive)

                ]

                ]

        ]

];


//
void SEventTest::OnCheckBoxChanged(ECheckBoxState NewState)
{

}

FReply SEventTest::OnButtonClicked()
{
    return FReply::Handled();
}


    ECheckBoxState OnCheckBoxActive() const
    {
        return ECheckBoxState::Checked;
    }

參考

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/29278-how-to-make-a-dockable-tab-in-a-plugin-also-hamad-s-plugin-corrected-unreal-4-7-0

猜你喜欢

转载自blog.csdn.net/qq173681019/article/details/83011992