Qt中QPainter的问题
2017-08-22 14:43
323 查看
我在进行2D绘制时,采用了QPainter的方法,想在QLabel上绘图,所以直接就QPainter painter, painter.begin(label);报错QPainter::begin: Paint device returned engine == 0, type: 1
QPainter::end: Painter not active, aborted
QWidget::paintEngine: Should no longer be called。
然后我通过在QPixMap上画再通过painter.begin(label); painter.drawPixmap(0,0, pixmap);
还是同样的报错。
最后索性就在pixmap上画图,然后painter.begin(this); paint.drawPixmap(label.x, label.y pixmap);一了百了。
前提是绘图代码得写在PaintEvent中。
QPainter::end: Painter not active, aborted
QWidget::paintEngine: Should no longer be called。
然后我通过在QPixMap上画再通过painter.begin(label); painter.drawPixmap(0,0, pixmap);
还是同样的报错。
最后索性就在pixmap上画图,然后painter.begin(this); paint.drawPixmap(label.x, label.y pixmap);一了百了。
前提是绘图代码得写在PaintEvent中。
相关文章推荐
- 模仿QtOpenGL例子VowelCube时遇到的三维和Qt绘图引擎QPainter混合问题
- Qt中的QPainter问题
- 一步步学Qt,第七天-QPainter绘图QRect定位问题
- Qt QPainter中坐标系变换问题
- 一步步学Qt,第七天-QPainter绘图QRect定位问题
- 一步步学Qt,第七天-QPainter绘图QRect定位问题
- QT问题系列(1) - QT安装步骤时出现no space left on device
- Qt界面中文显示乱码问题
- Qt编译问题-向导生成的helloworld都编译出错
- qt4 升级到 qt5需要注意的问题
- 关于QT 无边框窗口移动问题
- c++test使用qt中的 mingw 创建pthread_create程序无法运行的问题
- Qt开发中的实用笔记二--中文转码问题和string转换问题:
- Qt不能加载MySql驱动问题 (无需重新编译驱动)
- QT中QPainter的使用及矩形、圆形等常见图形的画法
- QT 文件下载后指定存放文件路径问题
- VS中使用QT,多国语言翻译问题
- linux下Qt5.3安装以及输入法问题
- 发布中文Qt程序时要注意的问题
- ubuntu14.04.2kylin下安装qt-sdk或qtcreator出现问题解决方法