QImage image(width, height, QImage::Format_RGB32); QPainter painter(&image); //绘制背景颜色 painter.fillRect(image.rect(