示例#1
0
bool ProcessFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
    ProcessModel *source = dynamic_cast<ProcessModel *>(sourceModel());
    if (!source)
        return true;

    const ProcData &data = source->dataForRow(source_row);

    if (!data.abi.isValid())
        return false;

    // hide ourselves as well as the process that launched us
    if (data.ppid == m_currentProcId || data.name.startsWith(QLatin1String("gammaray"), Qt::CaseInsensitive))
        return false;

    if (!m_currentUser.isEmpty() && data.user != m_currentUser)
        return false;

    return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}
示例#2
0
bool ProcessFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
  ProcessModel *source = dynamic_cast<ProcessModel*>(sourceModel());
  if (!source) {
    return true;
  }

  const ProcData &data = source->dataForRow(source_row);

  if (data.type == ProcData::NoQtApp) {
    return false;
  }

  if (data.ppid == m_currentProcId) {
    return false;
  }

  if (!m_currentUser.isEmpty() && data.user != m_currentUser) {
    return false;
  }

  return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}