Help to creat a broken lines editor with the Graphics View Framework
-
Hello,
I would like to create a QGraphicsView to display broken lines which might be editable by drag and drop on the breakpoints (which have the role of key).
How should I organize the Items of the QGraphicsScene?
I thought creat a class to contain a QList<QGraphicsLineItem>. But I'm asking how to organize the QGraphicsLineItem of the same broken line relative to each others.
Should the first QGraphicsLineItem be the parent of the others?
How to do if I want that the differents QGraphicsLineItem of my broken line stay together after (or even during) a drag.In fact, I'm frightened by begin in a difficult way beacause I didn't realize there is a simpler way, I don't know very well the Graphics and Drag and Drop Features of Qt.
Thanks.
(Sorry for my English mistakes) -
Please do look at the documentation and understand it for yourself, but
just adding them to the group allows you to treat them as a single item when you need to do that.The group becomes the parent of the item when you add them. You can keep the pointers to the line items in your list so that you can access easily them individually when you need to.
I use the group items this way all the time.