PDA

View Full Version : QGraphicView draw map shapes performance low?



wjingyao
20th June 2013, 16:07
hi,all:

recently i just read out the doc about QGraphicsView framwork.

and i just had a map app.

this app draw only the line of Frontier and Province , the whole country painte on the graphicsview well. with scroll and scale.

but problem occours when i add the QSimpleText of many city's name in the view.

scrolling and scale became slow.

i thought there must be some wrong with me ,because its just lines,point, text. no any pixelmap backgroup.




compare to the example of 40000 item from QT's doc, i had quesions below:

1. i just use one QGraphicPathItem to represent the Frontier of the whole nation.
that means there is a complex Pathitem ,which boundingRect is almost filling the whole viewport,
is that a problem?
if i scroll a bit ,what will happen? the whole Frontier will be redraw?
should i move this complex line to backgroud layer?
or should i break the complex frontier to small pieces?
i just dont known the the qraphicsView drawing Mechanism.

2. my code is very simple, after add one pathItem of Frontier,
i add many polygonItems of every Provinces,
then add simpletextitems of every city's name.

is this archtect occour problem from the aspect of performance?
split them into GraphicView's layer will improve performance?

3. i am planing to add movable object such as flying plane, i got a question about what part will be redraw when an small object moving,
is the plane's rect only be drawn Or the whole Frontier line??

becuase i thought the plane's boundingRect is Collisioning with the Frontier line's boundingRect beneath, then the view will
assume the two item both need be redrawn.

4. i see some post said to close the BSP tree indexing. my view item are almost static line, if i close the BSP tress, will i imrove performance? although they are static, but i need scroll and scale, i think BSP will help the painter find which part need to be redraw fast, am i right?