您的位置:首页 > 大数据 > 人工智能

QPainter::begin: Paint device returned engine == 0, type: 2

2016-04-25 11:38 627 查看
如果出现 “QPainter::begin: Paint device returned engine == 0, type: 2” 的问题

需要检查 QPainter 画布的大小。

pixmap 的Size =0, 或者

pixmap 的Size 过大 都会引起这个问题。

When you get a message from QPainter saying that the engine returned 0, this means that for some reason it is unable to paint on the paint device in question. Pretty much all the times you see this it would be in relation to a QPixmap or a QImage. In the
case of QPixmap/QImage it means that it is null, meaning that it has no size set which is why it cannot paint to it. This is either because no size was specified for it or because the size requested was too big that it would have caused an overflow which meant
that it ended up not having that size set. If you call isNull() then most of the time it will return true, but sometimes it is possible that QPixmap will not return true but will still have a problem if the size of the pixmap was too large. Reducing the size
will make it work.

原文出处 : http://blog.qt.digia.com/blog/2012/08/03/qt-commercial-support-weekly-23-explaining-the-warningserrors-2/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: