#include#include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); // Create a QGraphicsScene and add an ellipse item QGraphicsScene scene; scene.addEllipse(0, 0, 100, 50); // Create a QGraphicsView and set the scene QGraphicsView view(&scene); // Show the view view.show(); return a.exec(); }
#includeThis example creates a QApplication and a QGraphicsView to display the scene. The QGraphicsScene function addEllipse is used to add two ellipse items to the scene with different coordinates and sizes. The package library used in these examples is Qt, specifically the Qt graphics view framework.#include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); // Create a QGraphicsScene and add two ellipse items QGraphicsScene scene; scene.addEllipse(0, 0, 100, 50); scene.addEllipse(50, 50, 75, 75); // Create a QGraphicsView and set the scene QGraphicsView view(&scene); // Show the view view.show(); return a.exec(); }