summaryrefslogtreecommitdiffstats
path: root/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-07-22 18:49:45 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2021-08-18 22:31:17 +0200
commit8aefbe67bf445d51f41c16ec00bc5ce3ec18ded5 (patch)
tree5485d33e6d07b3d19b8dfd794b799fb223321bfb /src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
parent96810e3863272eb5463ba5c07d82544810bdb3f8 (diff)
QtConcurrent: fix examples of overloaded methods in docs
Wrap the overloaded methods in qOverload(), to make the examples compile. Also remove the extra whitespaces when declaring nested templates. Pick-to: 6.1 6.2 Change-Id: If438caa6d705d9036dae45278fb26e080918da89 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp')
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
index b9ff35c798..30bbf0af0a 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
@@ -82,7 +82,7 @@ void addToDictionary(QSet<QString> &dictionary, const QString &string)
}
QStringList strings = ...;
-QFuture<QSet<QString> > dictionary = QtConcurrent::filteredReduced(strings, allLowerCase, addToDictionary);
+QFuture<QSet<QString>> dictionary = QtConcurrent::filteredReduced(strings, allLowerCase, addToDictionary);
//! [4]
@@ -93,7 +93,7 @@ QFuture<QString> lowerCaseStrings = QtConcurrent::filtered(strings.constBegin(),
// filter in-place only works on non-const iterators
QFuture<void> future = QtConcurrent::filter(strings.begin(), strings.end(), allLowerCase);
-QFuture<QSet<QString> > dictionary = QtConcurrent::filteredReduced(strings.constBegin(), strings.constEnd(), allLowerCase, addToDictionary);
+QFuture<QSet<QString>> dictionary = QtConcurrent::filteredReduced(strings.constBegin(), strings.constEnd(), allLowerCase, addToDictionary);
//! [5]
@@ -121,7 +121,8 @@ QFuture<QImage> grayscaleImages = QtConcurrent::filtered(images, &QImage::isGray
// create a set of all printable characters
QList<QChar> characters = ...;
-QFuture<QSet<QChar> > set = QtConcurrent::filteredReduced(characters, &QChar::isPrint, &QSet<QChar>::insert);
+QFuture<QSet<QChar>> set = QtConcurrent::filteredReduced(characters, qOverload<>(&QChar::isPrint),
+ qOverload<const QChar&>(&QSet<QChar>::insert));
//! [7]
@@ -131,7 +132,8 @@ QFuture<QSet<QChar> > set = QtConcurrent::filteredReduced(characters, &QChar::is
// create a dictionary of all lower cased strings
extern bool allLowerCase(const QString &string);
QStringList strings = ...;
-QFuture<QSet<int> > averageWordLength = QtConcurrent::filteredReduced(strings, allLowerCase, QSet<QString>::insert);
+QFuture<QSet<QString>> lowerCase = QtConcurrent::filteredReduced(strings, allLowerCase,
+ qOverload<const QString&>(&QSet<QString>::insert));
// create a collage of all gray scale images
extern void addToCollage(QImage &collage, const QImage &grayscaleImage);