#includeint main() { QSizeF size(10.0, 20.0); qInfo("Height: %f", size.height()); // Output: Height: 20.000000 return 0; }
#includeThis example creates a new QGraphicsRectItem object with a height of 50 and a width of 100. The `rect()` method is called on the object, which returns a QRectF object that contains the dimensions of the item's bounding rectangle. The `height()` method is then called on the QRectF object to obtain the height value. The `qInfo()` function is used to print the height to the console. Package Library: Qt Core module.int main() { QGraphicsRectItem rect(0, 0, 100, 50); qInfo("Height: %f", rect.rect().height()); // Output: Height: 50.000000 return 0; }