SDetailsView doesn’t seem supposed to be used outside private engine code. It’s even defined in a Private folder.
If your goal is to create a details panel like the World Settings one, you can use SSingleObjectDetailsPanel. You just need to add #import "SSingleObjectDetailsPanel" to your code and add "KismetWidgets" to your module’s .build.cs file, in PrivateDependencyModuleNames.
Then, create a widget class extending from SSingleObjectDetailsPanel and implement the correct methods. I guess a good and straight-forward example in the engine is the details panel for the SpriteEditor in Paper2D. Take a look at the file Engine\Plugins\2D\Paper2D\Source\Paper2DEditor\Private\SpriteEditor.cpp:252
Found another way, even simpler and used with much more frequency in the engine source, so it’s probably the newest/better way to do it (because we know Paper2D, where I got my previous answer from, hasn’t been updated in a while).
Using the IDetailsView interface, the process is pretty straight forward. And the way it’s instantiated, you’re actually using a SDetailsView, just indirectly.
Create a FDetailsViewArgs variable to set the detail view’s settings.
Use FPropertyEditorModule::CreateDetailView to create an IDetailsView instance.
Pass your UObject instance that needs its properties displayed to the IDetailsView::SetObject method.
Add the IDetailsView instance as some widget’s child.
I’m using it as a child in a custom widget, but in the engine code, on the World Settings tab creation, they just used the IDetailsView directly. Here’s a shortened snippet of that as an example:
// setup the detail view settings
FDetailsViewArgs DetailsViewArgs( false, false, true, FDetailsViewArgs::HideNameArea, false, GUnrealEd );
DetailsViewArgs.bShowActorLabel = false;
// create the detail view widget
WorldSettingsView = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor").CreateDetailView( DetailsViewArgs );
// set the object to have its properties displayed
// create the tab with the details view in it
return SNew( SDockTab )
You also need to add "KismetWidgets" to your module’s .build.cs file, in PrivateDependencyModuleNames.