mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 11:12:49 +00:00
SNI: Sort items
Reloading/adding new items causes jumps in the item order. Sorting should stabilize the order
This commit is contained in:
parent
884d3f1324
commit
09ec1bfab6
1 changed files with 8 additions and 0 deletions
|
@ -364,6 +364,14 @@ namespace SNI
|
||||||
container->SetOrientation(Utils::GetOrientation());
|
container->SetOrientation(Utils::GetOrientation());
|
||||||
Utils::SetTransform(*container, {-1, true, Alignment::Fill, 0, 8});
|
Utils::SetTransform(*container, {-1, true, Alignment::Fill, 0, 8});
|
||||||
iconBox = container.get();
|
iconBox = container.get();
|
||||||
|
|
||||||
|
// Sort items, so they don't jump around randomly
|
||||||
|
std::sort(items.begin(), items.end(),
|
||||||
|
[](const Item& a, const Item& b)
|
||||||
|
{
|
||||||
|
return a.name < b.name;
|
||||||
|
});
|
||||||
|
|
||||||
for (auto& item : items)
|
for (auto& item : items)
|
||||||
{
|
{
|
||||||
if (item.iconData)
|
if (item.iconData)
|
||||||
|
|
Loading…
Reference in a new issue