QImage和QPixmap相互转换


    QPainter p(this);
    QPixmap pixmap;
    pixmap.load("../image/路飞.jpg");

    //QPixmap->QImage
    QImage tempImage = pixmap.toImage();
    p.drawImage(0,0,tempImage);

    QImage image;
    image.load("../image/路飞.jpg");

    //QImage->QPixmap
    QPixmap tempPixmap = QPixmap::fromImage(image);
    p.drawPixmap(450,0,tempPixmap);

相关推荐
©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页