DrawText() taking high cpu usage.
DrawText() is taking lot of CPU usage.what else to use instead of this. or is there any other way to improve DrawText().
With this information there is no way in the world that someone can help you.
What drawText function, which platform, where you painting, which paint device etc.
On the embedded platform this is typically caused by no-hardware support for painting so the CPU must rendrer every pixel by himself.
i'm using Qt with GCF on Fedora 13.
i've one scene from which i've 7 views in which i'm rendering text with drawText().
it is fine until i'm using one view with enabled text rendering but with 6 extra views and text rendering enabled application performance get degraded and CPU usage reach to 100%. so what should i use for text rendering.
i'm painting on QGraphicsItem.
i'm using drawText() like this:-
Not sure if I understand you corretlty:
- one QGraphicsScene
- 7 QGraphicsViews?
You're drawing something on each QGraphicsView, not on QGraphicsScene or you're creating your Subclassed QGraphicsItem with the paint() function reimplemented and you're adding it to the scene?
You're drawing something on each view? In which way? Maybe drawing on one causes calls to redraw the rest of them? So instead of 7 draws, you have 49? Or even quite-unlimited amount of them when this is wrongly set up.
When this Hi-load cpu occurs? On adding item to the scene or when i.e. you're moving some item with a mouse?
yes gmaro you got it correctly.
I am using one QGraphicsScene and seven QGraphicsViews.
i am creating my subclassed QGraphicsItem with paint() function reimplemented and adding it to scene.
actually only one view is main, and all other 6 views are copy of this view.It is my requirement, that ever item and operation that is in main view has to be in all other six views.
high CPU load is occurring after i'm showing all other 6 views.
Please put something like
qDebug() << PRETTY__FUNCTION;
or any string you like inside the reimplemented paint() function to check how many this function is called in case of one view and how many in case of 7 views.
That would give a good hint.
Moved to the General Forum, this is Qt related and no C++ issue.