Esempio n. 1
0
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);
    }
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
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);
    }
}
Esempio n. 4
0
void ModuleListWidget::setFilter(QString filter) {

   m_filter = filter.trimmed();

   for (int idx=0; idx<count(); ++idx) {

      const auto i = item(idx);
      filterItem(i);
   }
}