QGraphicsScene scene; scene.setSceneRect(0, 0, 500, 500);
QGraphicsScene scene; QRectF rect(-100, -100, 200, 200); scene.setSceneRect(rect);In this example, a new QGraphicsScene is created and the sceneRect property is set to a rectangle defined by the QRectF object with a top-left corner at (-100, -100) and a width and height of 200. These code examples demonstrate how to set the sceneRect property of a QGraphicsScene, which allows you to define the region where graphical items can be placed and manipulated. The Qt library is used in this case for implementing the QGraphicsScene.