Important: Please read the Qt Code of Conduct -

QString::fromRawData ref count behavior

  • My software program needs to be able to manage its own string data for certain classes. Therefore I have a structure that creates a QString from data contained in those classes using the QString::fromRawData method. My question is what happens to that data when the reference count drops to zero? From my understanding QString deletes data when it is no longer needed (reference count is equal to zero). Is this true for QString created from raw data as well? I don't want a QString created with this method to delete the string data contained within their original classes and info regarding this possibility is not documented.

  • Lifetime Qt Champion


    From the documentation, QString::fromRawData doesn't take ownership of the data it surveys.

Log in to reply