This change moves the snippets and images to the modularized directories.
Change-Id: If52f69c0f8bb4d2df4ee46f5524a82047ec214de
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
--- /dev/null
+include(../../../doc/global/qt-cpp-ignore.qdocconf)
+
+project = QtConcurrent
+description = Qt Concurrent Reference Documentation
+url = http://qt-project.org/doc/qt-5.0/qtconcurrent
+version = 5.0.0
+
+sourceencoding = UTF-8
+outputencoding = UTF-8
+naturallanguage = en_US
+qhp.projects = QtConcurrent
+
+qhp.QtConcurrent.file = qtconcurrent.qhp
+qhp.QtConcurrent.namespace = org.qt-project.qtconcurrent.500
+qhp.QtConcurrent.virtualFolder = qdoc
+qhp.QtConcurrent.indexTitle = Qt Concurrent Reference Documentation
+qhp.QtConcurrent.indexRoot =
+
+qhp.QtConcurrent.filterAttributes = qtconcurrent 5.0.0 qtrefdoc
+qhp.QtConcurrent.customFilters.Qt.name = QtConcurrent 5.0.0
+qhp.QtConcurrent.customFilters.Qt.filterAttributes = qtconcurrent 5.0.0
+qhp.QtConcurrent.subprojects = classes overviews examples
+qhp.QtConcurrent.subprojects.classes.title = Classes
+qhp.QtConcurrent.subprojects.classes.indexTitle = Qt Concurrent's Classes
+qhp.QtConcurrent.subprojects.classes.selectors = class fake:headerfile
+qhp.QtConcurrent.subprojects.classes.sortPages = true
+qhp.QtConcurrent.subprojects.overviews.title = Overviews
+qhp.QtConcurrent.subprojects.overviews.indexTitle = All Overviews and HOWTOs
+qhp.QtConcurrent.subprojects.overviews.selectors = fake:page,group,module
+qhp.QtConcurrent.subprojects.examples.title = Qt Concurrent Examples
+qhp.QtConcurrent.subprojects.examples.indexTitle = Qt Concurrent Examples
+qhp.QtConcurrent.subprojects.examples.selectors = fake:example
+
+dita.metadata.default.author = Qt Project
+dita.metadata.default.permissions = all
+dita.metadata.default.publisher = Qt Project
+dita.metadata.default.copyryear = 2012
+dita.metadata.default.copyrholder = Nokia
+dita.metadata.default.audience = programmer
+
+sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc"
+headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx"
+
+examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml *.css"
+examples.imageextensions = "*.png"
+
+outputdir = ../../../doc/qtconcurrent
+tagfile = ../../../doc/qtconcurrent/qtconcurrent.tags
+
+HTML.generatemacrefs = "true"
+HTML.nobreadcrumbs = "true"
+
+HTML.templatedir = .
+
+HTML.stylesheets = ../../../doc/global/style/offline.css
+
+HTML.headerstyles = \
+ " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline.css\" />\n"
+
+HTML.endheader = \
+ "</head>\n" \
+
+defines = Q_QDOC \
+ QT_.*_SUPPORT \
+ QT_.*_LIB \
+ QT_COMPAT \
+ QT_KEYPAD_NAVIGATION \
+ QT_NO_EGL \
+ Q_WS_.* \
+ Q_OS_.* \
+ Q_BYTE_ORDER \
+ QT_DEPRECATED \
+ QT_DEPRECATED_* \
+ Q_NO_USING_KEYWORD \
+ __cplusplus \
+ Q_COMPILER_INITIALIZER_LISTS
+
+versionsym = QT_VERSION_STR
+
+codeindent = 1
+
+depends += qtcore
+
+headerdirs += ..
+
+sourcedirs += ..
+
+exampledirs += ../../../examples \
+ ../ \
+ snippets
+
+imagedirs += images
QFuture::constBegin() or QFuture::constEnd() before you start iterating.
Here's a typical loop that prints all the results available in a future:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qfuture.cpp 0
+ \snippet code/src_concurrent_qfuture.cpp 0
\sa QFutureIterator, QFuture
*/
list (i.e. before the first result). Here's how to iterate over all the
results sequentially:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qfuture.cpp 1
+ \snippet code/src_concurrent_qfuture.cpp 1
The next() function returns the next result (waiting for it to become
available, if necessary) from the future and advances the iterator. Unlike
Here's how to iterate over the elements in reverse order:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qfuture.cpp 2
+ \snippet code/src_concurrent_qfuture.cpp 2
If you want to find all occurrences of a particular value, use findNext()
or findPrevious() in a loop.
an easy way to ensure that all futures have finished before returning from
a function:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qfuturesynchronizer.cpp 0
+ \snippet code/src_concurrent_qfuturesynchronizer.cpp 0
The behavior of waitForFinished() can be changed using the
setCancelOnWait() function. Calling setCancelOnWait(true) will cause
Example: Starting a computation and getting a slot callback when it's
finished:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qfuturewatcher.cpp 0
+ \snippet code/src_concurrent_qfuturewatcher.cpp 0
Be aware that not all asynchronous computations can be canceled or paused.
For example, the future returned by QtConcurrent::run() cannot be
boundaries, provided that the exception inherit from QtConcurrent::Exception
and implement two helper functions:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp 0
+ \snippet code/src_concurrent_qtconcurrentexception.cpp 0
QtConcurrent::Exception subclasses must be thrown by value and
caught by reference:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp 1
+ \snippet code/src_concurrent_qtconcurrentexception.cpp 1
If you throw an exception that is not a subclass of QtConcurrent::Exception,
the Qt Concurrent functions will throw a QtConcurrent::UnhandledException
\fn QtConcurrent::Exception::raise() const
In your QtConcurrent::Exception subclass, reimplement raise() like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp 2
+ \snippet code/src_concurrent_qtconcurrentexception.cpp 2
*/
/*!
\fn QtConcurrent::Exception::clone() const
In your QtConcurrent::Exception subclass, reimplement clone() like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp 3
+ \snippet code/src_concurrent_qtconcurrentexception.cpp 3
*/
/*!
result instead of a QFuture. You use them in the same way as the
asynchronous variants.
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 6
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 6
Note that the result types above are not QFuture objects, but real result
types (in this case, QStringList and QSet<QString>).
The filter function must be of the form:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 0
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 0
T must match the type stored in the sequence. The function returns true if
the item should be kept, false if it should be discarded.
This example shows how to keep strings that are all lower-case from a
QStringList:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 1
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 1
The results of the filter are made available through QFuture. See the
QFuture and QFutureWatcher documentation for more information on how to
If you want to modify a sequence in-place, use QtConcurrent::filter():
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 2
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 2
Since the sequence is modified in place, QtConcurrent::filter() does not
return any results via QFuture. However, you can still use QFuture and
The reduce function must be of the form:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 3
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 3
T is the type of the final result, U is the type of items being filtered.
Note that the return value and return type of the reduce function are not
Call QtConcurrent::filteredReduced() like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 4
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 4
The reduce function will be called once for each result kept by the filter
function, and should merge the \e{intermediate} into the \e{result}
instead of a sequence. You use them in the same way as the sequence
variants:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 5
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 5
\section2 Using Member Functions
QtConcurrent::filteredReduced() accept pointers to member functions.
The member function class type must match the type stored in the sequence:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 7
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 7
Note that when using QtConcurrent::filteredReduced(), you can mix the use of
normal and member functions freely:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 8
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 8
\section2 Using Function Objects
add state to a function call. The result_type typedef must define the
result type of the function call operator:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 13
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 13
\section2 Using Bound Function Arguments
As an example, we use QString::contains():
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 9
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 9
QString::contains() takes 2 arguments (including the "this" pointer) and
can't be used with QtConcurrent::filtered() directly, because
use QString::contains() with QtConcurrent::filtered() we have to provide a
value for the \e regexp argument:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 10
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 10
The return value from boost::bind() is a function object (functor) with
the following signature:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 11
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 11
This matches what QtConcurrent::filtered() expects, and the complete
example becomes:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentfilter.cpp 12
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 12
*/
/*!
the final result instead of a QFuture. You use them in the same
way as the asynchronous variants.
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 7
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 7
Note that the result types above are not QFuture objects, but real result
types (in this case, QList<QImage> and QImage).
The map function must be of the form:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 0
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 0
T and U can be any type (and they can even be the same type), but T must
match the type stored in the sequence. The function returns the modified
This example shows how to apply a scale function to all the items
in a sequence:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 1
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 1
The results of the map are made available through QFuture. See the
QFuture and QFutureWatcher documentation for more information on how to
If you want to modify a sequence in-place, use QtConcurrent::map(). The
map function must then be of the form:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 2
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 2
Note that the return value and return type of the map function are not
used.
Using QtConcurrent::map() is similar to using QtConcurrent::mapped():
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 3
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 3
Since the sequence is modified in place, QtConcurrent::map() does not
return any results via QFuture. However, you can still use QFuture and
The reduce function must be of the form:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 4
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 4
T is the type of the final result, U is the return type of the map
function. Note that the return value and return type of the reduce
Call QtConcurrent::mappedReduced() like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 5
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 5
The reduce function will be called once for each result returned by the map
function, and should merge the \e{intermediate} into the \e{result}
instead of a sequence. You use them in the same way as the sequence
variants:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 6
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 6
\section2 Blocking Variants
the final result instead of a QFuture. You use them in the same
way as the asynchronous variants.
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 7
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 7
Note that the result types above are not QFuture objects, but real result
types (in this case, QList<QImage> and QImage).
QtConcurrent::mappedReduced() accept pointers to member functions.
The member function class type must match the type stored in the sequence:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 8
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 8
Note that when using QtConcurrent::mappedReduced(), you can mix the use of
normal and member functions freely:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 9
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 9
\section2 Using Function Objects
add state to a function call. The result_type typedef must define the
result type of the function call operator:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 14
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 14
\section2 Using Bound Function Arguments
As an example, we'll use QImage::scaledToWidth():
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 10
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 10
scaledToWidth takes three arguments (including the "this" pointer) and
can't be used with QtConcurrent::mapped() directly, because
QImage::scaledToWidth() with QtConcurrent::mapped() we have to provide a
value for the \e{width} and the \e{transformation mode}:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 11
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 11
The return value from boost::bind() is a function object (functor) with
the following signature:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 12
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 12
This matches what QtConcurrent::mapped() expects, and the complete example
becomes:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentmap.cpp 13
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 13
*/
/*!
To run a function in another thread, use QtConcurrent::run():
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 0
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 0
This will run \e aFunction in a separate thread obtained from the default
QThreadPool. You can use the QFuture and QFutureWatcher classes to monitor
Passing arguments to the function is done by adding them to the
QtConcurrent::run() call immediately after the function name. For example:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 1
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 1
A copy of each argument is made at the point where QtConcurrent::run() is
called, and these values are passed to the thread when it begins executing
Any return value from the function is available via QFuture:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 2
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 2
As documented above, passing arguments is done like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 3
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 3
Note that the QFuture::result() function blocks and waits for the result
to become available. Use QFutureWatcher to get notification when the
For example, calling QByteArray::split() (a const member function) in a
separate thread is done like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 4
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 4
Calling a non-const member function is done like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 5
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 5
\section2 Using Bound Function Arguments
Calling a bound function is done like this:
- \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 6
+ \snippet code/src_concurrent_qtconcurrentrun.cpp 6
*/
/*!