How to rotate a slate widget

According to 4.5 change log

But I am not able to find any functions in slate to rotate a widgets.

There is no function like “SetRotation/Location” on Slate widgets so you have to implement them on your own or set RenderTransform parameters.


SAssignNew(ImageWidget, SImage)
.RenderTransform_Static(&::GetTestRenderTransform)
.Image(GetStyle().GetBrush("UE4Icon"))

where GetTestRenderTransform is:


TOptional<FSlateRenderTransform> GetTestRenderTransform()
{
	return TransformCast<FSlateRenderTransform>(Concatenate(Shear, Scale, Rot));
}


There is an example of that and more in STestSuite.cpp file (Engine\Source\Runtime\AppFramework\Private\Widgets\Testing).

Hope this helps.

2 Likes