我在进行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中。