diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-01-11 14:43:48 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-01-17 13:13:48 +0000 |
commit | 6553c3c99e3a24da95fa6816989083eef45ba5c2 (patch) | |
tree | 6c8cfc9425c400b2b6f83be585a8cf96fc0e7a8b /src/plugins/qtsupport/qtkitinformation.cpp | |
parent | dd438a34451053040615e1b67703322b0d6f170b (diff) |
BaseQtVersion: Allow for a predicate when retrieving Qt versions
Make methods used to retrieve Qt versions from the Qt versions manager
take a predicate to select the interesting version.
Change-Id: I9218c57bae6d5033d49d618dfc0da41fe578444d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/qtsupport/qtkitinformation.cpp')
-rw-r--r-- | src/plugins/qtsupport/qtkitinformation.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/plugins/qtsupport/qtkitinformation.cpp b/src/plugins/qtsupport/qtkitinformation.cpp index 00410ed3d99..bef3c55f221 100644 --- a/src/plugins/qtsupport/qtkitinformation.cpp +++ b/src/plugins/qtsupport/qtkitinformation.cpp @@ -58,15 +58,14 @@ QVariant QtKitInformation::defaultValue(const Kit *k) const Q_UNUSED(k); // find "Qt in PATH": - QList<BaseQtVersion *> versionList = QtVersionManager::unsortedVersions(); - BaseQtVersion *result = findOrDefault(versionList, equal(&BaseQtVersion::autodetectionSource, - QString::fromLatin1("PATH"))); + BaseQtVersion *result = QtVersionManager::version(equal(&BaseQtVersion::autodetectionSource, + QString::fromLatin1("PATH"))); if (result) return result->uniqueId(); // Use *any* desktop Qt: - result = findOrDefault(versionList, equal(&BaseQtVersion::type, - QString::fromLatin1(QtSupport::Constants::DESKTOPQT))); + result = QtVersionManager::version(equal(&BaseQtVersion::type, + QString::fromLatin1(QtSupport::Constants::DESKTOPQT))); return result ? result->uniqueId() : -1; } @@ -161,12 +160,9 @@ int QtKitInformation::qtVersionId(const ProjectExplorer::Kit *k) id = -1; } else { QString source = data.toString(); - foreach (BaseQtVersion *v, QtVersionManager::unsortedVersions()) { - if (v->autodetectionSource() != source) - continue; + BaseQtVersion *v = QtVersionManager::version([source](const BaseQtVersion *v) { return v->autodetectionSource() == source; }); + if (v) id = v->uniqueId(); - break; - } } return id; } |