fruzzo
18th October 2012, 16:40
Hi,
I'm developing something like a Gantt diagram (see attached image):
8318
I have a QTimer that every 100msec update my time cursor (the black vertical line) in the diagram and other widgets but I noticed that the effective update rate is more than 100ms.
First of all, I known that the QTimer isn't so perfect in timing however, without my time cursor update, other widgets are updated about every 110 msec (but this is another story :)).
Adding my time cursor update the performance is degraded so checking my code I found that the QGraphicsView::paintEvent execution time is about 60-70msec.
Cursor time is drawed in MyGraphicsScene::drawForeground such as the dotted horizontal line are dreawed in MyGraphicsScene::drawBackground.
As suggested in other posts:
Horizontal green rectangle are items having cache enabled ( setChacheMode (ItemCoordinateCache) ).
I can't set view interactive property to false because I need my scene to be clickable.
I'm using Qt 4.5.0 so I can't set ItemHasNoContents flag
I haven't explicit set the OpenGL engine so I suppose that I'm using the raster one
How can I increase my perferomace reducing the QGraphicsView::paintEvent execution time so that I've an update rate near to 100msec?
I'm developing something like a Gantt diagram (see attached image):
8318
I have a QTimer that every 100msec update my time cursor (the black vertical line) in the diagram and other widgets but I noticed that the effective update rate is more than 100ms.
First of all, I known that the QTimer isn't so perfect in timing however, without my time cursor update, other widgets are updated about every 110 msec (but this is another story :)).
Adding my time cursor update the performance is degraded so checking my code I found that the QGraphicsView::paintEvent execution time is about 60-70msec.
Cursor time is drawed in MyGraphicsScene::drawForeground such as the dotted horizontal line are dreawed in MyGraphicsScene::drawBackground.
As suggested in other posts:
Horizontal green rectangle are items having cache enabled ( setChacheMode (ItemCoordinateCache) ).
I can't set view interactive property to false because I need my scene to be clickable.
I'm using Qt 4.5.0 so I can't set ItemHasNoContents flag
I haven't explicit set the OpenGL engine so I suppose that I'm using the raster one
How can I increase my perferomace reducing the QGraphicsView::paintEvent execution time so that I've an update rate near to 100msec?