QGraphicView Optimizing cpu
hello
I have edit a Qt application using QGraphicsView / QGraphicScene and it's consume a lot of cpu (60%).
my classes are a custom QGraphicsView / QGraphicScene and Reimplemented and used for drawing some statics items.
and i think thats methods causes the big consume of cpu.
my question is how can i optimise my application and reducing cpu consume.
thanx in advance.:)
Re: QGraphicView Optimizing cpu
Without seeing any actual code it is hard to suggest anything.
4 Attachment(s)
Re: QGraphicView Optimizing cpu
this is the sources of qgraphicsvew and qgraphicscene attached.
Attachment 8260Attachment 8261Attachment 8262Attachment 8263
Re: QGraphicView Optimizing cpu
First of all I don't think you should be calling QGraphicsView::drawForeground() from within drawBackground(). Second of all try reducing the amount of calculations done in drawBackground() and certainly do not create any items in drawForeground(). Apart from that, since you are caching the background, drawBackground() should not be very expensive as it is, unless you are changing the scene size (or zooming in and out) frequently. Then caching the background will slow down your app instead of speeding it up. In that case try removing the gradient from your background and see if it helps anything.
Re: QGraphicView Optimizing cpu