// create a transform matrix and set the scaling factor for the Y-axis QTransform transform; transform.setMatrix(1, 0, 0, 2, 0, 0); // apply the transformation to a graphics item QGraphicsItem* item; item->setTransform(transform);
// create a transform matrix and set the rotation angle to 45 degrees QTransform transform; transform.setMatrix(cos(45), -sin(45), sin(45), cos(45), 0, 0); // apply the transformation to a graphics item QGraphicsItem* item; item->setTransform(transform);This code example creates a QTransform matrix with a rotation angle of 45 degrees and applies this transformation to a QGraphicsItem. Package/library: Qt