QRect rect(10, 20, 30, 40); QRegion region(rect); QRect boundingRect = region.boundingRect();
QRegion region; region += QRect(10, 20, 30, 40); region += QRect(50, 60, 70, 80); QRect boundingRect = region.boundingRect();In this example, we create a QRegion object and add two rectangles to it using the += operator. We then call the boundingRect() method on the region object to get back the bounding rectangle of the region. Both of these examples use the Qt framework's QRegion class and are written in C++. Qt is a popular C++ library for creating GUI applications.