void NetworkDialog::filterItems(const QString &text) { int filterColumn = ui.filterLineEdit->currentFilter(); int count = ui.connecttreeWidget->topLevelItemCount (); for (int index = 0; index < count; index++) { filterItem(ui.connecttreeWidget->topLevelItem(index), text, filterColumn); } count = ui.unvalidGPGkeyWidget->topLevelItemCount (); for (int nIndex = 0; nIndex < count; nIndex++) { filterItem(ui.unvalidGPGkeyWidget->topLevelItem(nIndex), text, filterColumn); } }
bool NetworkDialog::filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn) { bool visible = true; if (text.isEmpty() == false) { if (item->text(filterColumn).contains(text, Qt::CaseInsensitive) == false) { visible = false; } } int visibleChildCount = 0; int count = item->childCount(); for (int index = 0; index < count; ++index) { if (filterItem(item->child(index), text, filterColumn)) { ++visibleChildCount; } } if (visible || visibleChildCount) { item->setHidden(false); } else { item->setHidden(true); } return (visible || visibleChildCount); }
void NetworkDialog::filterItems(const QString &text) { int filterColumn = ui.filterLineEdit->currentFilter(); int count = ui.connectTreeWidget->topLevelItemCount (); for (int index = 0; index < count; ++index) { filterItem(ui.connectTreeWidget->topLevelItem(index), text, filterColumn); } }
void ModuleListWidget::setFilter(QString filter) { m_filter = filter.trimmed(); for (int idx=0; idx<count(); ++idx) { const auto i = item(idx); filterItem(i); } }