use QImage::fromData
1 void XXX::paintEvent(QPaintEvent*) 2 { 3 //... 4 5 QImage image = QImage::fromData(ptr,size); 6 QPainter painter(this); 7 QRect rcPhoto = ui->frame->frameRect(); 8 rcPhoto.translate(ui->frame->pos()); 9 painter.drawImage(rcPhoto,image); 10 }
qt5 get image data from RAM and show
原文:https://www.cnblogs.com/lanmufan/p/14221410.html