MiniProjectTargetSelector: Fix wrong sorting

We need to sort indexes based on results. Also fix that with
too tooSmall being true, <= was used instead of <.

Broken in 12103e0f67

Change-Id: Ia8b7484fdea41776050b1a7ef85789cc49deab78
Reviewed-by: Nikita Baryshnikov <nib952051@gmail.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Daniel Teske
2014-07-09 12:56:30 +02:00
parent cfc7cae6c5
commit ece0c7c937

View File

@@ -780,9 +780,15 @@ QVector<int> MiniProjectTargetSelector::listWidgetWidths(int minSize, int maxSiz
if (result[i] != -1)
indexes.append(i);
Utils::sort(indexes, [&](int i, int j) -> bool {
return (result[i] > result[j]) ^ tooSmall;
});
if (tooSmall) {
Utils::sort(indexes, [&result](int i, int j) {
return result[i] < result[j];
});
} else {
Utils::sort(indexes, [&result](int i, int j) {
return result[i] > result[j];
});
}
int i = 0;
int first = result[indexes.first()]; // biggest or smallest