Triggering drawForeground and drawBackground
-
I have been looking for a way to trigger drawForground after updating properties on mouse move, first I was using
update()method of graphics scene, it worked prefectly, but I didn't want to trigger and entire update every time the mouse moved in my case (a selection box)anyhow, I found the solution in documentation and it worked perfectly
https://doc.qt.io/qt-6/qgraphicsscene.html#invalidatenow I call this everytime I want to trigger only the forground layer redraw
self.invalidate(self.sceneRect(), QGraphicsScene.ForegroundLayer)best regrads,
Iyad -
There's a catch though,
graphics_scene.update()makes the forground drawn even outside the boundaries of the scene, which is what I desired in my case, invalidate with scene rect doesn't, because it is limited to the rect we pass to it