QPaintDevice: Cannot destroy paint device that is being painted

在paintEvent中,使用QPainter * 绘制图像出现此问题。解决:

1、改为不使用QPainter指针。

2、添上begin(), end()

QPainter * painter = new QPainter();
painter->begin (this);//!!!
painter->drawLine (...);
painter->end ();//!!!

 

 

 

 

 

你可能感兴趣的:(QPaintDevice: Cannot destroy paint device that is being painted)