Alexander Volkov wrote:
> Currently it reads into QString as in a buffer and if you need to copy
> the buffer, then you
> have to manually make a deep copy of it:
>      QTextStream ts(...);
>      QString line;
>      line.reserve(1024);
>      QStringList found;
>      while (ts.readLineInto(&line)) {
>          ...
>          found.append(QString(line.constData(), line.size())); // deep
>          copy
>      }

This should also work:
      QTextStream ts(...);
      QString line;
      line.reserve(1024);
      QStringList found;
      while (ts.readLineInto(&line)) {
          ...
          QString copy = line;
          copy.data(); // force detach (deep copy)
          found.append(copy);
      }

        Kevin Kofler

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

Reply via email to