Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
None
-
4.8.0
-
None
Description
Add QImage constructors that take ownership of the provided buffer and deallocate it automatically
QImage(uchar *data, int width, int height, int bytesPerLine, Format format, void (*dtor)(void *data), void *dtorArg = 0)
QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, void (*dtor)(void *data), void *dtorArg = 0)
~QImageData() will call dtor(dtorArg) when dtorArg != 0 and dtor(data) otherwise.
This will allow to "convert" externally created image objects (from other toolkits and libraries) to QImage without the need to do memcpy and without the need to manually track external object's lifetime.