C++ Slate Compound Widget Not showing up in editor window

Following this tutorial Epic UE 5.1 C++ Slate Tutorial The last part has you add your SCompoundWidget class to the module created when you add a stand alone editor window plugin.

SNew(SQuickStartWindowMenu)

however, when i do this, nothing renders in the view. When you take all the Slate declarations and put them directly in the same function (replacing the snippet above), it all renders. There are no build error or warnings. I’ve tried the hot reload and rebuilding the C++ of the project in visual studio.

To be clear this:

SNew(SVerticalBox)
+SVerticalBox::Slot()
.AutoHeight()
[
    SNew(SHorizontalBox)
    +SHorizontalBox::Slot()
    .VAlign(VAlign_Top)
    [
        SNew(STextBlock)
        .Text(FText::FromString("Test Button"))
    ]
    +SHorizontalBox::Slot()
    .VAlign(VAlign_Top)
    [
        SNew(SButton)
        .Text(FText::FromString("Press Me"))
    ]
]
+SVerticalBox::Slot()
.AutoHeight()
[
    SNew(SHorizontalBox)
    +SHorizontalBox::Slot()
    .VAlign(VAlign_Top)
    [
        SNew(STextBlock)
        .Text(FText::FromString("Test Checkbox"))
    ]
    + SHorizontalBox::Slot()
    .VAlign(VAlign_Top)
    [
        SNew(SCheckBox)
    ]
]

when put inside the TabRole() declaration of the module class created when creating a standalone editor plugin works. As soon as you put it in a custom widget and call that widget in the same TabRole() declaration (replacing your code as it was moved into the widget) nothing renders.

I’ve tried creating the widget a few different ways…

SNew(SDockTab)
.TabRole(ETabRole::NomadTab)
[
SNew(SMyWidget)
]
SNew(SDockTab)
.TabRole(ETabRole::NomadTab)
[
SNew(SVerticalBox)
+SVerticalBox::Slot()
[
SNew(SMyWidget)
]
]

It doesn’t matter what the contents of SMyWidget::Construct(constFArguments& InArgs) are, they don’t show up in the editor window.
What am i doing wrong

1 Like

found the answer. the docs are a bit confusing. the whole issue was that i wasn’t wrapping my content in a childslot block in my custom slate object. the docs here: Slate Editor Window Quickstart Guide for Unreal Engine | Unreal Engine 5.1 Documentation say to remove the contents of the commented out code in construct method (which, to me, includes removing the childslot block). it then says that in the construct function add the new slate widgets and gives you a code block to presumably follow/copy which doesn’t include the childslot block.

so the docs/guide for the slate editor window quickstart guide should be updated to not have the childslot block commented out and verbiage updated stating that all items need to be inside the child slot declaration.

3 Likes

But I follow your answer to try.
There is still not showing up anything in editor window.
Can you past your all code in SQuickStartWindowMenu.cpp ?

Do I need to add “return” before SNew(SDockTab)?
If I don’t, there is still nothing. If I do, there is a error when complie.

ok, I found the answer.
Need to do two things.

  1. Include SQuickStartWindowMenu.h in SlateQuickstartWindow.cpp.
    image

  2. add “SNew(SQuickStartWindowMenu)” in SNew(SDockTab) block.
    image

Thank you! I was tearing my hair out to figure out what was wrong.

1 Like