Dynamically set widget position on canvas panel?

I know I’m kinda late to this post, but I’m looking to do this in C++ and I can’t seem to find the solution, any idea?