Can I rotate a widget?

Hi there,

I want to place a widget, let’s say using AddChild(createWidget(…)), but I want to have it added at an arbitrary rotation. Is this possible? I do not want to animate it afterwards (though it would be cool), just want it to be rotated on the panel.

If there’s a way, a simple example would be awesome.

Thanks, Marcelo.

Just pass your vector position to createWidget(). If you want rotations, put your widget inside a TransformWidget.

Hmmm… I am missing some point here … Not sure yet how to “put the widget inside a TransformWidget”.

Still trying to wrap my head around it. Do you have any hints?

Widgets live in a hierarchical scene graph.

TransformWidget* tw = new TransformWidget;
tw->rotate(2 * M_PI / 8);

AH! got it…

I understand now. Thanks man!

Just to be sure: The rotation happens around the upper left corner of the widget, not its center, right?

I think so. Since rotations are just linear transformations, you can rotate around any origin with


Yup … that’s my plan … I will test and verify what’s the actual origin and then apply modifications as needed … thanks man.