Hi Folks,
I would need some advice regarding the below problem.
Problem Description:
I have to create a painting widget , which loads a image , on which I can put marker with paint brush. The widget need to have mouse pointer centralized scaling with mouse scroll.
I had two choices to implement it:
1 ) Using QGraphicsView framework.
2) implementing a simple paintarea by extending QWidget and displaying QImage on it using QPainter.
The problem I am facing is by using either of the choices I can not implement all the features I need , the first method has nice features for implementing scaling with mouse scroll , but seems like QGraphicsView
has it's own internal painter , so I can not use a new painter for the QPixmap inside QgraphicsView , as it gives run time exception that "QPainter::begin: A paint device can only be painted by one painter at a time." . Also the painting due to QGraphicsView is not permanent on the widget , i.e. if in next paint event I do not redraw all the previously marked content , the framework removes all the painting and restores the original image , i.e the marking is not permanent to the pixmap of the graphics item.
In the second method I am not able to implement scaling properly and I could not find any opensource example doing the same.
I would be very grateful for any advice solving my problem.
Many thanks and regards
Avanindra Singh




Reply With Quote
Bookmarks