bool MySortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
    QModelIndex index1 = sourceModel()->index(source_row, 2, source_parent);
    QModelIndex index2 = sourceModel()->index(source_row, 3, source_parent);

    return sourceModel()->data(index1).toString().contains(filterRegExp())
           && dateInRange(sourceModel()->data(index2).toDate());
}
Exemplo n.º 2
0
bool PCModel::filterAcceptsRow(int sourceRow,
		const QModelIndex &sourceParent) const
{
	QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
	QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
	QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);

	return (sourceModel()->data(index0).toString().contains(filterRegExp())
			|| sourceModel()->data(index1).toString().contains(filterRegExp()))
			&& dateInRange(sourceModel()->data(index2).toDate());
}
bool SortFilterProxyModel::filterAcceptsRow(int sourceRow,
        const QModelIndex &sourceParent) const
{
    if(type == "DirFile")
    {
        QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
        QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
        QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
        QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);

#if NOT_HIDE_ROWS_WHEN_FILTER
        if(!filterRegExp().isEmpty())
        {
            if(sourceModel()->data(index3).toString().contains(filterRegExp()))
            {
                if(!pHighlightIndexs.contains(index3))
                {
                    pH->append(mapFromSource(index3));
                }
            }
        }
        //return true;
        return (dateInRange(sourceModel()->data(index0).toString())
                && sourceModel()->data(index1).toString().contains(cur_choice_component)
                && sourceModel()->data(index2).toString().contains(cur_choice_operation));

#else
        return (dateInRange(sourceModel()->data(index0).toString())
                && sourceModel()->data(index1).toString().contains(cur_choice_component)
                && sourceModel()->data(index2).toString().contains(cur_choice_operation)
                && sourceModel()->data(index3).toString().contains(filterRegExp()));
#endif
    }
    else if(type == "SingleFile")
    {
        QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
        QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
        QModelIndex index3 = sourceModel()->index(sourceRow, 3, sourceParent);
        QModelIndex index5 = sourceModel()->index(sourceRow, 5, sourceParent);

#if NOT_HIDE_ROWS_WHEN_FILTER
        if(!filterRegExp().isEmpty())
        {
            if(sourceModel()->data(index5).toString().contains(filterRegExp()))
            {
                if(!pHighlightIndexs.contains(index5))
                {
                    pH->append(mapFromSource(index5));
                }
            }
        }
        //return true;
        return (sourceModel()->data(index1).toString().contains(cur_choice_component)
                && sourceModel()->data(index2).toString().contains(cur_choice_operation)
                && dateInRange(sourceModel()->data(index3).toString()));

#else
        return (dateInRange(sourceModel()->data(index0).toString())
                && sourceModel()->data(index1).toString().contains(cur_choice_component)
                && sourceModel()->data(index2).toString().contains(cur_choice_operation)
                && sourceModel()->data(index3).toString().contains(filterRegExp()));
#endif
    }
    else
        return true;
}
Exemplo n.º 4
0
bool DateFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
    F_TRACE;
    QModelIndex date_idx = sourceModel()->index(sourceRow, column, sourceParent);
    return  dateInRange(sourceModel()->data(date_idx).toDate());
}