问题
Hello friends I am working on a project and I have a problem. See Images below

This purple rectangle is my main region which I want to rotate and transform. I have rotated this using Qtransform rotate at 30 degrees and has size(180,173). I have calculated the cords of inner region and pass those to paint event and when I resize outer Rectangle this inner rectangle is drawn using painterpath see image below

So my question is, Is there any method to calculate at what angle inner region gets transformed If yes please help me guys.
回答1:
I assume you are able to get coordinates of target figure (after applying the transform). You can get the angle (in radiance) between a vector and the X axis using atan2
function:
QPointF vector = vector_end - vector_start;
double angle = atan2(vector.y(), vector.x());
Difference of angle
values of two vectors will give you angle between those two vectors. You may need to make sure that the difference is in [0, 2π] range by adding or substracting 2π.
来源:https://stackoverflow.com/questions/29671481/how-to-calculate-transformation-using-coordinates-of-rectangle