// create a rectangle QRectF rect(10, 20, 30, 40); // create a transform to scale the rectangle QTransform transform; transform.scale(2, 2); // apply the transform to the rectangle QRectF scaledRect = transform.map(rect); // print out the new rectangle qDebug() << scaledRect;
// load an image from a file QImage image("my_image.png"); // create a transform to rotate the image QTransform transform; transform.rotate(45); // apply the transform to the image QImage rotatedImage = image.transformed(transform); // display the rotated image QLabel label; label.setPixmap(QPixmap::fromImage(rotatedImage)); label.show();This code loads an image from a file, creates a QTransform object to rotate it by 45 degrees, and applies the transform to the image using the `transformed()` function. The resulting image is then displayed in a QLabel widget. Both of these examples use the QTransform class from the QtGui module of the Qt library.