2016-07-11 21:21 GMT+02:00 Sune Vuorela <[email protected]>:
> On 2016-07-11, Allan Sandfeld Jensen <[email protected]> wrote:
>> On Monday 11 July 2016, Benjamin TERRIER wrote:
>>> QImage::detach() is not public API.
>>> However QPixmap::detach() is, so why QImage::detach() couldn't be made
>>> public too?
>>>
>> It probably should be. It is a lot more sensible to use than copy(rect()).
>
> https://codereview.qt-project.org/#/c/164886/
>
> /Sune
>
> _______________________________________________
> Development mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/development

Just something worth stating here, from Mark Mutz on the codereview:
    "QImage::detach() doesn't (if the QImage was constructed from the
mutable-uchar* ctor)."

So it's seem that all detach() functions which are internal will not
detach when using external data which is the case discussed here in
the first place.
However detach() member functions which are part of the public API
(e.g QPixmap::detach()) will always detach.

The consequence is that for Tomasz Olszak's use case calling
QImage::detach() is a bad idea because (1) it is not public API and
(2) it will NOT detach. So the only solution seems to call the non
const version of bits() as suggested earlier.

BR,

Benjamin Terrier
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to