Hi,everyone!
I draw a large amount of point in pixmap. and then draw pixmap onto qgraphicsview which last was placed in a gridlayout. And when i resize the window, paintEvent is recalled which bring the repaint of large points on the pixmap. So i took QPixmapCache into account, and i use QPixmapCache::remove(key,pixmap) when there really need to repaint the pixmap such as point data changed, after drawing points on the pixmap ,and i use QPixmapCache::insert(key,pixmap) into the cache again. As we all know that QGraphicsview:aintEvent() is automatically recalled by Qt when you move mouse or use resizeEvent() , so as long as there's no need to repaint pixmap ,i just fetch the pixmap from the cache each time and the use drawPixmap(0,0, pixmap). And yes ,it really got what i need , it has enhance the speed.
but here came the problem, there only show a corner graphics of the pixmap whenever how i resize the window use resizeevent. but i have validated that i have draw all points in the pixmap and store it into the cache successfully when the data first come. Why i use resizeEvent, but the visible graphics of the pixmap hold in line with the same graphics when the wigdet is shown at first? Why? I'm sure that i have paint all the points in the pixmap completely. and i do can store and fetch from the cache.
Wish your help please. this problem has trouble me several days.Thank your very much!


aintEvent() is automatically recalled by Qt when you move mouse or use resizeEvent() , so as long as there's no need to repaint pixmap ,i just fetch the pixmap from the cache each time and the use drawPixmap(0,0, pixmap). And yes ,it really got what i need , it has enhance the speed.
Reply With Quote


Bookmarks