QPainter::setPen: Painter not active问题解决
来源:互联网 发布:张德芬害人不浅 知乎 编辑:程序博客网 时间:2024/06/03 19:51
经过我的测试,产生此中问题的有以下两个原因:
1、没有在QPainterEvent中绘图,而是在其他处。(如果想在其他处实现绘图操作,建议使用双缓冲机制进行绘制,
先把图形绘制到QPixmap中,然后调用update()函数,系统就会自动调用QPainterEvent虚函数,所以只需要继承QWidget,
然后重写其PainterEvent函数即可,双缓冲机制详情见我写的文章:Qt绘图双缓冲机制)
2、第二种原因是我自己测试出来的,当用QPainter对象在其begain()函数之前调用setpen()就会出现此错误,而在begain和end
函数之间调用setpen函数此错误就会消失。
注意:经过我的测试,多次为一个QPainer对象设置同一个pen并不会造成此种现象的产生。
阅读全文
3 1
- QPainter::setPen: Painter not active问题解决
- QPainter::setFont: Painter not active和 QPainter::setPen: Painter not active
- Painter not active
- qt error: variable `QPainter painter' has initializer but incomplete type
- Qt QPainter::end: Painter ended whith 2 saced states
- 在社区内核上使用libvirt工具时为网络not active问题解决方法
- QPainter
- QPainter
- QPainter
- QPainter
- QPainter
- QPainter
- QPainter
- Painter
- Painter
- ORA-21779: duration not active
- This device is not active
- Painter 11 中文汉化破解版下载及问题解决
- maven pom文件的剖析
- redis 管道和事物
- 虚拟机安装Linux遇到的问题
- RN开发总结
- php封装操作数据库的类
- QPainter::setPen: Painter not active问题解决
- Ajax中Post和Get的区别
- TensorFlow实现Softmax Regression手写数字识别
- BZOJ 2243: [SDOI2011]染色 树链剖分
- HLS 肤色检测
- gdal GeoTransform[]数组参数介绍
- 查询练习1
- MySQL中建立索引的集中方式
- 软件开发人月成本估算方法