#includeint main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; QRect rect(50, 50, 100, 100); QPoint bottomLeft = rect.bottomLeft(); qDebug() << "Bottom-left coordinate: " << bottomLeft; w.show(); return a.exec(); }
#includeThis example creates a QImage object and draws a rectangle with a QPainter object. It retrieves the bottom-left coordinate of the rectangle and draws a dot to represent it. Finally, it saves the resulting image to a file.int main(int argc, char *argv[]) { QApplication a(argc, argv); QRect rect(50, 50, 100, 100); QImage image(rect.size(), QImage::Format_ARGB32); QPainter painter(&image); painter.drawRect(rect); QPoint bottomLeft = rect.bottomLeft(); qDebug() << "Bottom-left coordinate: " << bottomLeft; painter.drawPoint(bottomLeft); painter.end(); image.save("image.png"); return 0; }