Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-21447

Errors in the examples of the QtConcurrentRun documentation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Done
    • Affects Version/s: 4.7.4
    • Fix Version/s: None
    • Component/s: Documentation
    • Commits:
      fc4cc4598e9f2f774fdc3622cab7e2eeb7e3a1fc

      Description

      The examples in the QtConcurrentRun documentation 'Using member functions' have errors (http://doc.qt.nokia.com/4.7/qtconcurrentrun.html#using-member-functions).

      The example of calling QByteArray::split() has an extra bracket. It would also be nice for the split to actually happen (the bytearray would have a comma). This would work:

          QByteArray bytearray = "hello, world";
          QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split, ',');
          ...
          QList<QByteArray> result = future.result();
      

      The example of calling QImage::invertPixels is not doing anything to the image right now. A reference to the image should be given for the QtConcurrent::run:

          QImage image = ...;
          QFuture<void> future = QtConcurrent::run(&image, &QImage::invertPixels, QImage::InvertRgba);
          ...
          future.waitForFinished();
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qtcomsupport Qt Support
            Reporter:
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes