QT一直输出打印 QPainter::begin: Painter already active

QPainter::begin: Painter already active
QPainter::begin: Painter already active
QPainter::begin: Painter already active
QPainter::begin: Painter already active
QPainter::begin: Painter already active
QPainter::begin: Painter already active
QPainter::begin: Painter already active

重新实现paintEvent函数时,如果使用QPainter painter(this);,再使用begin、end则会重复包含QPainter

如下程序,是错在不断输出的问题

void arrivedstation::paintEvent(QPaintEvent *event)
{QPainter painter(this);QColor color(0,0,0,255);QPen pen;pen.setWidth(4);pen.setColor(color);painter.setPen(pen);painter.begin(this);painter.drawLine(QPoint(560,55),QPoint(620,55));painter.drawLine(QPoint(590,45),QPoint(620,55));painter.drawLine(QPoint(590,65),QPoint(620,55));painter.end();
}

修改后的程序

void arrivedstation::paintEvent(QPaintEvent *event)
{QPainter painter(this);QColor color(0,0,0,255);QPen pen;pen.setWidth(4);pen.setColor(color);painter.setPen(pen);//painter.begin(this);painter.drawLine(QPoint(560,55),QPoint(620,55));painter.drawLine(QPoint(590,45),QPoint(620,55));painter.drawLine(QPoint(590,65),QPoint(620,55));//painter.end();
}

QPainter::begin: Painter already active相关推荐

  1. QPainter::begin: Painter already active问题解决方案

    文章目录 1 问题重现 2 原因 3 解决方法 1 问题重现 2 原因 重新实现paintEvent函数时,如果使用QPainter painter(this);,再使用begin.end则会重复包含 ...

  2. QPainter::setPen: Painter not active问题解决

    经过我的测试,产生此中问题的有以下两个原因: 1.没有在QPainterEvent中绘图,而是在其他处.(如果想在其他处实现绘图操作,建议使用双缓冲机制进行绘制, 先把图形绘制到QPixmap中,然后 ...

  3. Painter not active

    写qt碰到一个bug,求大神告诉我原因 记录下,顺便附象棋代码 QPainter::begin: A paint device can only be painted by one painter a ...

  4. QPainter::begin: Paint device returned engine == 0, type: 2 解决方法,在使用第三方库Qt可视化节点编辑器时

    QT节点编辑器:https://github.com/paceholder/nodeeditor 在使用的时候,沿着对角线缩放节点会出现崩溃的情况 报出来的错误却是:Qt begin: Paint d ...

  5. Qt QPainter::end: Painter ended whith 2 saced states

    在使用Qt  QPainter 的时候,有时会遇到"QPainter::end: Painter ended whith 2 saced states" 这时由于我们在使用的QPa ...

  6. QPainter的使用过程中遇到的一些问题,QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device

    报错信息 QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine ...

  7. QPainter::begin: Paint device returned engine == 0, type: 2 解决方法

    出问题的代码段希望将painterdevice设置为图片,如下: QPixmap picture; QPainter painter;if(painter.begin(&picture)) / ...

  8. 【原创】互联网行业数据分析通识(中)

    数据说·梦想季 努力的意义就是以后的日子里放眼望去全部都是自己喜欢的人和事.  前言  上一期我们从互联网行业特性.互联网行业常见的数据指标.数据分析概述等几个方面了解一下基于互联网行业背景下的数据分 ...

  9. Qt中 QPainter 刷新出现的问题

    最近学习Qt 自定义绘画时碰到两个问题,问题如下: 自定义绘画图形,采用重写QPaintEvent,发现绘画不起作用: 1.Qpainter不刷新,解决方法:在触发刷新是,调用updata()函数强行 ...

最新文章

  1. io流文本文档的快速读取
  2. SAP成都研究院数字创新空间小伙伴们在2020 SAP上海DKOM
  3. Extjs4 MVC 添加view层
  4. php 设置中文 cookie, js获取
  5. 如何才能成为超级人类,驯服人工智能?
  6. Python vim 环境搭建
  7. php post 漏洞_WordPress漏洞分析
  8. SwitchyOmega规则列表地址
  9. tensorflow应用问题记录
  10. kettle数据库乱码问题
  11. DEA模型及matlab应用1:CCR模型与BCC模型
  12. linux和windows php pdf转图片,扩展安装imagick和ImageMagick
  13. 【译文】人工智能给伦敦带来了它的大脑和经济收益
  14. T1119 紧急措施(逐句精解)
  15. UCenter 通信
  16. Linux No space left on device 磁盘空间不足
  17. springboo+elasticsearch+经纬度查询
  18. 使用sqoop迁移mysql数据到hive
  19. 关于微信公众号开发时获取用户昵称作为参数乱码的问题
  20. 大数据架构师入门学习

热门文章

  1. caffe例子mnist
  2. 动态交通信息“心”服务
  3. 基于stc15f2k60s2芯片单片机编程(串口+超声波)
  4. 第一个用pr和au制作出的作品
  5. java编程入门pdf_Java 8编程入门官方教程(第6版) [(美)Schildt H.] 中文完整pdf扫描版[233MB]...
  6. c语言中函数作用于数组,详解C语言中的函数、数组与指针
  7. ffserver服务器实现WebM格式视频直播
  8. Deepin中使用Windows字体
  9. 大学知识下放高中:平面法向量的求法
  10. 九城入股G10 觊觎研发