Creating a pedigree chart
-
I would like to create a family pedigree chart. The tree should contain rounded rectangles with text inside the rectangle such as persons name. I would like to use a Qgraphicsscene. How can I create a single object that contains what I need so that I can addItem to scene.
-
Hi and welcome to devnet,
Do you mean combining a QGraphicsTextItem and a custom QGraphicsItem drawing a rounded rectangle like shown in the documentation of the class ?
-
I have been over each of the documents. I believe that the QGraphicsItem class document gives me a clue on how to get it done. But I not sure if I should be going towards the SimpleItem class example. Or using the part where it says items can contain other items. The tree would have a few hundred items.
-
@ByronCoughlin
Hi
Basically you would create a custom item to draw the nodes as you want to.
Maybe a simply composite class would be enough, reusing the existing items
where your class would then setup a rect and text element.
There is also the option to simply draw it as you want.
https://www.bogotobogo.com/Qt/Qt5_QGraphicsView_QGraphicsScene_QGraphicsItems.php -
@ByronCoughlin
well i would do it that way since its pretty simple painting operations
and you seems not to need to be able to click on the sub items.
(like the text) so just painting seems fine as opposed to maintaining
sub items Text/rect. Of cause it really depends on the actual use case.