#includeint main() { // Create a rectangle QRectF rect(0, 0, 100, 100); // (x, y, width, height) // Create a point QPointF point(50, 50); // (x, y) // Check if the point lies within the rectangle bool isContained = rect.contains(point); // isContained will be true }
#includeThe package library used for this code is Qt Core module which contains numerous classes and functions for various purposes.int main() { // Create two rectangles QRectF rect1(0, 0, 100, 100); // (x, y, width, height) QRectF rect2(25, 25, 50, 50); // Check if rect2 is fully contained within rect1 bool isContained = rect1.contains(rect2); // isContained will be true }