QTransform transform; transform.scale(2, 2); transform.rotate(45); transform.translate(50, 50); // Output the matrix before resetting qDebug() << transform; transform.reset(); // Output the matrix after resetting qDebug() << transform;
QTransform transform1; transform1.scale(2, 2); QTransform transform2 = transform1; transform2.rotate(45); qDebug() << "Transform 1:" << transform1; qDebug() << "Transform 2:" << transform2; // Reset the second transform only transform2.reset(); qDebug() << "Transform 1:" << transform1; qDebug() << "Transform 2 (reset):" << transform2;This example demonstrates making a copy of a QTransform object, then modifying the copy while the original is still in its original state. After resetting the second transform, the output confirms that only the second transform was modified while the first stayed untouched. This library is included in the Qt core library.