Painting without PaintEvent and QGraphicsItem s Management
The Scenario is I am getting Rects of Images over the socket and I need to draw it in a Scrollable Canvas. at the moment I am using a QGraphicsScene
and drawing using QGraphicsPixmapItem
but after few times when one pixmap overlaps another there is no need to keep the bottom one. and I dont know any simple way to find out the overlapped item and delete
it. so its supposed to take huge memory if overlapping goes on like this.
there exists another way out. Make a QWidget
and put it in a QScrollArea
now draw the QWidget using a QPainter
(outside paintEvent ?). If I draw it outside paintEvent
I need to inherit the QWidget
and make a custom one. pass it a Pixmap and let it draw in its own paintEvent by calling update()
Any cri开发者_C百科tiques ? any other Straight forward solutions there ?
精彩评论