forked from qt-creator/qt-creator
Algorithms: Introduce helper Utils::equal
Takes a member (function) pointer and a value and returns a functor, that takes a instance of the mfp's class and returns whether it's equal to value. Sounds complicated, but is a common pattern that is easy to understand. Change-Id: Iaaeb90488d34ddfd6940dadd4c66705381198fee Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -544,11 +544,8 @@ void ExamplesListModel::updateQtVersions()
|
||||
// try to select the previously selected Qt version, or
|
||||
// select examples corresponding to 'highest' Qt version
|
||||
int currentQtId = m_exampleSetModel->getQtId(currentIndex);
|
||||
BaseQtVersion *newQtVersion = Utils::findOr(m_qtVersions,
|
||||
0,
|
||||
[¤tQtId](BaseQtVersion *version) {
|
||||
return version->uniqueId() == currentQtId;
|
||||
});
|
||||
BaseQtVersion *newQtVersion = Utils::findOrDefault(m_qtVersions,
|
||||
Utils::equal(&BaseQtVersion::uniqueId, currentQtId));
|
||||
|
||||
if (!newQtVersion)
|
||||
newQtVersion = findHighestQtVersion();
|
||||
|
||||
Reference in New Issue
Block a user