QRect rect(0, 0, 100, 100); // creating a QRect object rect.setTop(50); // setting the top edge value
QRect rect(50, 50, 100, 100); // creating a QRect object rect.setTop(25); // setting the top edge valueThis code creates a QRect object with a top-left coordinate of (50,50), width of 100, and height of 100. The setTop() function is then used to set the top edge to 25. Package Library: Qt