I am writing a Qt application that has to handle big QImage s. QImage uses implicit sharing, which means it reference counts an internal data pointer. Whenever the refcount is > 1 the object counts as "shared" and any even only potentially data modifying call issues a deep copy of the image data.
In short: I don't want deep copies to happen.
I make a number of calls like setPixel(), bits() etc. that can trigger a copy. The documentation sometimes reads as if certain calls would always trigger a deep copy (detach call) even if I try my hardest to keep the refcount at 1. Like here: QImage::setPixel()
So I want to know:
- Is the doc only formulated a bit clumsily and these calls are reliably copying only shared objects (as in refcount > 1)?
- Can I ask an object what it's current refcount is, for debugging reasons and the like?
- Can I force Qt not to implicitly share specific objects/instances (<- well here my educated guess is "no")