The best way to create a composite QGraphicsItem
I'm trying to write a schematic editor, and I need a wire element that will connect the circuit elements. Wire is a few lines connected together. The number of lines will depend on the path's curvature. How should I proceed? Create a class inherited from QGraphicsItem which will store all of these lines or their points and draw them as a single element. Or to create a class inherited from QGraphicsItem, which by itself does not render anything, but is the parent for the lines (QGraphicsLineItem) that define a put from one element to another? If possible, suggest something else.
What I want? I want to have access to separate wire lines to change their position.
I'm not sure it's possible to give you a "best" option here, it depends too much on the details of your program. In general, however, your second suggestion is a small change to
QGraphicsItemGroup, so you may be able to subclass that instead and save yourself some trouble by letting it provide the bulk of the necessary functionality.