QRect rect(0, 0, 100, 50); int height = rect.height(); // returns 50
QRect rect(0, 0, 100, 50); rect.setHeight(75); // updates height value to 75This code creates a QRect object with same parameters as the previous example. It then sets the height value to 75 using the setHeight() function. Package library: Qt Core library.