PDA

View Full Version : Help with QGraphicsScene



justin123
2nd June 2010, 02:09
I need help with a small problem I can't seem to figure out. I'm drawing a grid and the width and height of each cell is changeable. Nothing is changed until I call the Update( QRECT) function. I came up with a quick solution to call it along with my drawGrid() function, but now it chokes the cpu since it is called all the time. A couple of segmentation faults later, I turned to you guys. Is there any way update the scene when it needs to be?

SixDegrees
2nd June 2010, 07:16
If it's segfaulting, there's something wrong somewhere other than your updates. Have you tried running in a debugger to see where the program is failing?

justin123
3rd June 2010, 00:48
I was the updates I made, so I removed those pieces of code. I saw in the documentation that the graphics view class had "setViewportUpdateMode ( ViewportUpdateMode mode )". Could this remedy the problem?

EDIT:

Fixed it. I connected a signal to the update() function. Works like a charm now!