diff options
author | Liang Qi <liang.qi@qt.io> | 2017-03-14 10:49:20 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-03-14 10:52:24 +0100 |
commit | 0c034a649f61019c16aba479fe79d20dde41f2f2 (patch) | |
tree | 54545862591044b65e618989805945bceb0b3ea5 /src/concurrent/qtconcurrentmap.cpp | |
parent | 2162f01111d21d0ce66ceb8be290b0a13653e691 (diff) | |
parent | df40b1115db600e8de1c4774476fa30956a34fd9 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/widgets/widgets/qpushbutton.cpp
Change-Id: I615de00e6e64540c50f658d4d8ab3e002d701a81
Diffstat (limited to 'src/concurrent/qtconcurrentmap.cpp')
-rw-r--r-- | src/concurrent/qtconcurrentmap.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index e6c347b511..884bf4b4f9 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -198,13 +198,11 @@ \snippet code/src_concurrent_qtconcurrentmap.cpp 14 - \section2 Using Bound Function Arguments + \section2 Wrapping Functions that Take Multiple Arguments If you want to use a map function that takes more than one argument you can - use std::bind() to transform it onto a function that takes one argument. If - C++11 support is not available, \l{http://www.boost.org/libs/bind/bind.html} - {boost::bind()} or \l{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf} - {std::tr1::bind()} are suitable replacements. + use a lambda function or \c std::bind() to transform it onto a function that + takes one argument. As an example, we'll use QImage::scaledToWidth(): @@ -216,16 +214,6 @@ QImage::scaledToWidth() with QtConcurrent::mapped() we have to provide a value for the \e{width} and the \e{transformation mode}: - \snippet code/src_concurrent_qtconcurrentmap.cpp 11 - - The return value from std::bind() is a function object (functor) with - the following signature: - - \snippet code/src_concurrent_qtconcurrentmap.cpp 12 - - This matches what QtConcurrent::mapped() expects, and the complete example - becomes: - \snippet code/src_concurrent_qtconcurrentmap.cpp 13 */ |