QRect myRect(0, 0, 100, 100); myRect.moveTopLeft(QPoint(50, 50));
QRect myRect(0, 0, 100, 100); myRect.moveTopLeft(myRect.topLeft() + QPoint(10, 10));This code creates a rectangle with a top-left corner at (0, 0) and a size of 100x100. The moveTopLeft method is then called with a new point that is the current top-left corner of the rectangle plus a 10-pixel offset in both the x and y directions. Package library: Qt library.