QByteArray

bool QPixmap::save(QIODevice *device, const char *format = Q_NULLPTR, int quality = -1) const

This is an overloaded function.

This function writes a QPixmap to the given device using the specified image file format and quality factor. This can be used, for example, to save a pixmap directly into a QByteArray:


 
          QPixmap pixmap;
          QByteArray bytes;
          QBuffer buffer(&bytes);
          buffer.open(QIODevice::WriteOnly);
          pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章