QGraphicsView print error : “QPainter::begin: Paint device returned engine == 0, type: 1”
- { [...] }
- {
- euro->load(euroName);
- }
Why return this error? I have read some post and i have found that the viewportEvent() method paint!!
What my error is?
Regards
2 replies
In general, you should, and in fact mostly cannot paint outside paint events (if you really really need this, you have to enable painting outside of the paintEvent by setting the flag Qt::WA_PaintOutsidePaintEvent. This is highly discouraged, though!).
If you want to paint in the QGraphiscView, You should reimplement QGraphicsView::paintEvent().
However, the correct solution is to use one of the two dedicated functions in QGraphicsView that allow you to paint behind all items in the background, or as overlay on top of all items:
virtual void drawBackground ( QPainter * painter, const QRectF & rect )
virtual void drawForeground ( QPainter * painter, const QRectF & rect )
Please look in the Qt Assistant documentation in QGraphicsView for further details.
You must log in to post a reply. Not a member yet? Register here!
