Quantcast
Channel: Installation and Deployment
Viewing all articles
Browse latest Browse all 22112

Writing QImage into a buffer always returns error

$
0
0
Hi, I tried to write a QImage into buffer as follows, bool MainWindow::somefunction(QImage &image) {     QByteArray bytes;     QBuffer buffer(&bytes);       buffer.open(QIODevice::WriteOnly);       if(image.save(&buffer, "JPG"))     {         qDebug() << "Error in writing to buffer";         ui->imgLabel->setPixmap(QPixmap::fromImage(image)); // A test write, and it displays correctly in imgLabel         buffer.close();         return false;     }     buffer.close();     return true; } The image contained in QImage is verified using a write to imgLabel, but the above code always retuns error

Viewing all articles
Browse latest Browse all 22112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>