1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

formatting

This commit is contained in:
Opuszek
2025-07-25 18:28:06 +02:00
parent 5bdc110b82
commit 49a0545e40

View File

@@ -135,9 +135,11 @@ void HeroSpellWidget::hideItemIfMatches(const QString & match)
void HeroSpellWidget::toggleHiddenForItemIfMatches(const QString & match, bool hidden)
{
QListWidget * spellLists[] = { ui->spellList1, ui->spellList2, ui->spellList3, ui->spellList4, ui->spellList5 };
for (const QListWidget * list : spellLists) {
for (const QListWidget * list : spellLists)
{
const auto items = list->findItems(match, Qt::MatchRegularExpression);
for (QListWidgetItem * item : items) {
for (QListWidgetItem * item : items)
{
item->setHidden(hidden);
}
}
@@ -147,16 +149,19 @@ void HeroSpellWidget::hideEmptySpellLists()
{
QListWidget * spellLists[] = { ui->spellList1, ui->spellList2, ui->spellList3, ui->spellList4, ui->spellList5 };
auto toggleSpellListVisibility = [&](const QListWidget * list, bool visible) {
auto toggleSpellListVisibility = [&](const QListWidget * list, bool visible)
{
auto * parent = list->parentWidget();
int index = ui->tabWidget->indexOf(parent);
ui->tabWidget->setTabVisible(index, visible);
};
for (const QListWidget * list : spellLists) {
for (const QListWidget * list : spellLists)
{
const auto allItems = list->findItems("*", Qt::MatchWildcard);
bool isListEmpty = true;
for (QListWidgetItem * item : allItems) {
for (QListWidgetItem * item : allItems)
{
if (!item->isHidden())
{
isListEmpty = false;