summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 10:16:59 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-23 10:32:54 (GMT)
commit42a9fe3042945937839eda3578655ca091422b28 (patch)
tree469836c6a28b06c3c2724e5037098c015a4241ad /doc
parentfa11bd40388e437e4f29aab93f1c368d428e28e3 (diff)
downloadQt-42a9fe3042945937839eda3578655ca091422b28.zip
Qt-42a9fe3042945937839eda3578655ca091422b28.tar.gz
Qt-42a9fe3042945937839eda3578655ca091422b28.tar.bz2
Doc: QtConcurrent::run. Make sure the example actually compiles
QString::split has overload, and if you want to take the address of a function with overload, you need to cast it. If we really wanted to use QString::split, we would have to do QFuture<QStringList> future = QtConcurrent::run(string, static_cast<QStringList (QString::*)(const QString &, QString::SplitBehavior, Qt::CaseSensitivity ) const>(&QString::split), QString (", "), QString::KeepEmptyParts, Qt::CaseSensitive); So use QByteArray::split as an example instead Task-number: QTBUG-12897 Reviewed-by: David Boddie
Diffstat (limited to 'doc')
-rw-r--r--doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
index 8f74461..cea6553 100644
--- a/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
+++ b/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp
@@ -73,16 +73,14 @@ QFuture<QString> future = QtConcurrent::run(someFunction, bytearray);
QString result = future.result();
//! [3]
-
//! [4]
-// call 'QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const' in a separate thread
-QString string = ...;
-QFuture<QStringList> future = QtConcurrent::run(string, &QString::split, QString(", "), QString::KeepEmptyParts, Qt::CaseSensitive);
+// call 'QList<QByteArray> QByteArray::split(char sep) const' in a separate thread
+QByteArray bytearray = "hello world;
+QFuture<QList<QByteArray> > future = QtConcurrent::run(bytearray, &QByteArray::split), ',');
...
-QStringList result = future.result();
+QList<QByteArray> result = future.result();
//! [4]
-
//! [5]
// call 'void QImage::invertPixels(InvertMode mode)' in a separate thread
QImage image = ...;