Actually make widgets track their indices.

This commit is contained in:
Lukas Brübach 2025-05-18 16:06:57 +02:00
parent 59998b38c2
commit 8032e7fea1
13 changed files with 213 additions and 246 deletions

View file

@ -548,6 +548,14 @@ void FlowLayout::addItem(QLayoutItem *item)
}
}
void FlowLayout::insertWidgetAtIndex(QWidget *toInsert, int index)
{
addChildWidget(toInsert);
items.insert(qBound(0, index, std::max(0, static_cast<int>(items.size()))), new QWidgetItem(toInsert));
invalidate();
}
/**
* @brief Retrieves the count of items in the layout.
* @return The number of layout items.