Solved Is there a way to get the raw bits of a QImage without a deep copy?
-
I'm looking to efficiently get the raw data behind a non-constant QImage, but QImage::bits() seems to always perform a deep copy. Is there a way to just get a pointer to the data?
-
Hi
http://doc.qt.io/qt-5/qimage.html#constScanLine
"this function does not perform a deep copy of the shared pixel data" -
Thanks for your response. I was under the impression that this only applies to images that have constant data. If the image changes will this return value update as well?
-
There is also a function constBits()...
-
@ntsirak1
Hi
The const part means you cannot modify the returned data (bits) and is meant for fast reading.
If you need to alter the image, the const functions are a no go. -
@mrjj Awesome, thanks a lot for clarifying. Marking as solved.