Qgraphicsitem Paint Delay
Solution 1:
I don't know the actual solution for this rendering artifacts. But, updating the view during mouseMoveEvent did fix the issue.
defmouseMoveEvent(self, event):
QGraphicsView.mouseMoveEvent(self, event)
ifself.scene().selectedItems():
self.update()
Solution 2:
The error you are seeing is probably because parts of what you are drawing are outside the bounding rectangle. My guess is you are using the same values to calculate the rectangle you are drawing as you are to calculate the bounding rectangle. Applying a pen then will make the drawn rectangle wider than the bounds and so will result in the smearing you are seeing.
Solution 3:
I had the same problem. This is my solution:
As @Nathan Mooth said, the problem was that I was drawing outside of the boundingRect, so I just made my rounded rectangle(what I'm drawing in the paint() method) 10 units width and height less than the boundingRect:
# Setup Rect
frameRect = self.boundingRect()
frameRect.setWidth(self.boundingRect().width() - 10)
frameRect.setHeight(self.boundingRect().height() - 10)
This is how it was looking before(GIF):
Note: I added color selection and changed the color of the drop shadow. So it looks a bit different.
Post a Comment for "Qgraphicsitem Paint Delay"