mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
formatting
This commit is contained in:
@@ -135,9 +135,11 @@ void HeroSpellWidget::hideItemIfMatches(const QString & match)
|
|||||||
void HeroSpellWidget::toggleHiddenForItemIfMatches(const QString & match, bool hidden)
|
void HeroSpellWidget::toggleHiddenForItemIfMatches(const QString & match, bool hidden)
|
||||||
{
|
{
|
||||||
QListWidget * spellLists[] = { ui->spellList1, ui->spellList2, ui->spellList3, ui->spellList4, ui->spellList5 };
|
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);
|
const auto items = list->findItems(match, Qt::MatchRegularExpression);
|
||||||
for (QListWidgetItem * item : items) {
|
for (QListWidgetItem * item : items)
|
||||||
|
{
|
||||||
item->setHidden(hidden);
|
item->setHidden(hidden);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,16 +149,19 @@ void HeroSpellWidget::hideEmptySpellLists()
|
|||||||
{
|
{
|
||||||
|
|
||||||
QListWidget * spellLists[] = { ui->spellList1, ui->spellList2, ui->spellList3, ui->spellList4, ui->spellList5 };
|
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();
|
auto * parent = list->parentWidget();
|
||||||
int index = ui->tabWidget->indexOf(parent);
|
int index = ui->tabWidget->indexOf(parent);
|
||||||
ui->tabWidget->setTabVisible(index, visible);
|
ui->tabWidget->setTabVisible(index, visible);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const QListWidget * list : spellLists) {
|
for (const QListWidget * list : spellLists)
|
||||||
|
{
|
||||||
const auto allItems = list->findItems("*", Qt::MatchWildcard);
|
const auto allItems = list->findItems("*", Qt::MatchWildcard);
|
||||||
bool isListEmpty = true;
|
bool isListEmpty = true;
|
||||||
for (QListWidgetItem * item : allItems) {
|
for (QListWidgetItem * item : allItems)
|
||||||
|
{
|
||||||
if (!item->isHidden())
|
if (!item->isHidden())
|
||||||
{
|
{
|
||||||
isListEmpty = false;
|
isListEmpty = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user