Sync of 2 qgraphicsview drawing
I have 2 qgraphicsviews, one right underneath the other. I have a line on both views at the same x position. When the user drags the line across the X axis on the top graphics view I want the bottom one to follow exactly.
In the itemChange function of the top line if I set the X position of the bottom line in ItemPositionChange the bottom line is slightly offset to one side while moving (settles in to correct position once I let go).
If I use ItemPositionHasChanged instead the line is slightly offset to the other side while moving (settles in to correct position once I let go).
How can I keep the two lines completely in sync while dragging?
Any help greatly appreciated!
Hi and welcome to devnet,
Are your two graphics view showing the content of different QGraphicsScene ?
Yes, the two stacked graphicsviews are showing different content, I have two lines, one on bottom and one on top, that should appear as one line. When dragging the top line the bottom one appear to be either one frame behind or one frame ahead depending on if I use ItemPositionChange or ItemPositionHasChanged to set the matching X position of the bottom line.
AFAIK, it's pretty much unavoidable since you have to transmit the new position while moving thus trigger a new paint event.