Converting QPixmap to QByteArray: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Add "cleanup" tag)
(Convert ExpressionEngine links)
Line 5: Line 5:
= Convert QPixmap to QByteArray =
= Convert QPixmap to QByteArray =


This is one way to convert "QPixmap":http://doc.qt.nokia.com/latest/qpixmap.html to "QByteArray":http://doc.qt.nokia.com/latest/qbytearray.html.
This is one way to convert [http://doc.qt.nokia.com/latest/qpixmap.html QPixmap] to [http://doc.qt.nokia.com/latest/qbytearray.html QByteArray].


Useful when you want to store a pixmap in a database etc.
Useful when you want to store a pixmap in a database etc.

Revision as of 08:17, 4 March 2015

This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

English Български

Convert QPixmap to QByteArray

This is one way to convert QPixmap to QByteArray.

Useful when you want to store a pixmap in a database etc.

QPixmap pixmap;
// Preparation of our QPixmap
QByteArray bArray;
QBuffer buffer( &bArray );
buffer.open( QIODevice::WriteOnly );
pixmap.save( &buffer, "PNG" );

Now variable bArray contains the byte array form of pixmap.

Categories snippets