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,
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.
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.
@mrjj So it sounds like I need to create a class that derives from QGraphicsItem. Have the boundingrect = to rounded rectangle. And in the paint add my text.
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.
@mrjj There are other obstacles that I need to overcome. But this way seems to be the solution that i am implementing.