The usual reason an object rotates around its upper left point, and not its center, is because it has its dimensions defined with 0.0 in the upper left corner, and not located in the center of the object.
You did not specify what the canvas object is, so assuming it is something like a QGraphicsRectItem, you will need to declare its top left, width, height as -x / 2, -y / 2, width, height, so that the center point the object was equal to 0.0. Then, when you rotate the object, it will rotate around its center.
In addition, you should try to separate the rotation and translation logic from the drawing functions for optimal performance.
source share