I want to get the size of my widget in its own preconstruct event for preview layout, I have tried: Self–>SlotAsCanvasSlot–>GetSize
but it only works when the anchor of this widget is top-left, I can only get the offset if the anchor is “top-fill”.
I have tried Self–>GetCachedGeometry->GetLocalSize
but this only works at runtime.
Is anyone can tell me how to get the size of an widget in its own PreConstruct evenet? Thank a lot for your time.
This would do the same as what OP asked for but would only execute in the designer/editor, since your widget should be ticking and get the cached geometry without any issues otherwise.