Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How can I create a "pie" using QGraphics.
Alvaro.sal last edited by
Hello forum, I want create a piece of pie using QGraphics, now I just get create a triangle but I need create a triangle with an arc (really a piece of pie). I saw an example using QPainter but my project is created using QGrapchics.
Now I made an QPolygon:
triangle_s1 << QPoint(0,0); triangle_s1 << QPoint(x1_s1,y_s1); triangle_s1 << QPoint(x2_s1,y_s1); triangle_s1 << QPoint(0,0);
where x1_s1, x2_s1 and y_s1 are the coordinates for my triangle and I don't know how can I create the arc and paint inside my pie.
So.. if somebody could help me I would very grateful.
Hi and welcome to devnet,
QGraphicsElipseItem comes to mind for that task.
Hope it helps
Joel Bodenmann last edited by
Maybe this example might be helpful too: https://doc.qt.io/qt-5/qtwidgets-itemviews-chart-example.html
It's not using
QGraphicsbut it might help you figuring out some parts of the drawing logic or similar.