forked from qt-creator/qt-creator
Examples: Fix which category gets two columns
It was giving the first category _alphabetically_ two columns. Which was correct a while ago, but since we have a separate category order defined, it should give the first category in that order two columns instead. Fixes: QTCREATORBUG-30634 Change-Id: Ie89c84f31617a9f90fe18b66bcea352ae3ea56d5 Reviewed-by: Kai Köhne <kai.koehne@qt.io>
This commit is contained in:
@@ -373,9 +373,9 @@ QList<std::pair<Core::Section, QList<ExampleItem *>>> getCategories(const QList<
|
|||||||
// order "known" categories as wanted, others come afterwards
|
// order "known" categories as wanted, others come afterwards
|
||||||
const int defaultIndex = defaultOrder.indexOf(it->first);
|
const int defaultIndex = defaultOrder.indexOf(it->first);
|
||||||
const int priority = defaultIndex >= 0 ? defaultIndex : (index + defaultOrderSize);
|
const int priority = defaultIndex >= 0 ? defaultIndex : (index + defaultOrderSize);
|
||||||
const std::optional<int> maxRows = restrictRows
|
const std::optional<int> maxRows = restrictRows ? std::make_optional<int>(
|
||||||
? std::make_optional<int>(index == 0 ? 2 : 1)
|
defaultIndex == 0 ? 2 : 1)
|
||||||
: std::nullopt;
|
: std::nullopt;
|
||||||
categories.append({{it->first, priority, maxRows}, it->second});
|
categories.append({{it->first, priority, maxRows}, it->second});
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user