QRect myRect(0, 0, 50, 50); // Create a rectangle with top-left at (0,0) and size 50x50. myRect.setY(100); // Set the top y-coordinate to 100.
QRect rect1(0, 0, 50, 50); QRect rect2(100, 100, 50, 50); rect1.setY(rect2.y() + rect2.height()); // Set the y-coordinate of rect1 to be just below the bottom of rect2.The QRect setY method is part of the Qt library.