Yes, it does, so here it is:
bool AdvancedSortFilterProxyModel
::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent
) const {
bool accept = true;
const QList<Filter>& andList = m_currentFilter.andList();
const QList<Filter>& orList = m_currentFilter.orList();
QList<Filter>::const_iterator it;
for (it = andList.begin(); it != andList.end(); it++)
{
index = sourceModel()->index(sourceRow, (*it).m_column, sourceParent);
switch ((*it).m_action)
{
case FilterAction_Has:
if (sourceModel()->data(index).toString().contains((*it).m_value) == false)
accept = false;
break;
case FilterAction_Is:
if ((sourceModel()->data(index).toString() == (*it).m_value.pattern()) == false)
accept = false;
break;
case FilterAction_LessThan:
if ((sourceModel()->data(index).toDouble() < (*it).m_value.pattern().toDouble()) == false)
accept = false;
break;
case FilterAction_MoreThan:
if ((sourceModel()->data(index).toDouble() > (*it).m_value.pattern().toDouble()) == false)
accept = false;
break;
default:
break;
}
}
for (it = orList.begin(); it != orList.end(); it++)
{
index = sourceModel()->index(sourceRow, (*it).m_column, sourceParent);
switch ((*it).m_action)
{
case FilterAction_Has:
if (sourceModel()->data(index).toString().contains((*it).m_value))
accept = true;
break;
case FilterAction_Is:
if ((sourceModel()->data(index).toString() == (*it).m_value.pattern()))
accept = true;
break;
case FilterAction_LessThan:
if ((sourceModel()->data(index).toDouble() < (*it).m_value.pattern().toDouble()))
accept = true;
break;
case FilterAction_MoreThan:
if ((sourceModel()->data(index).toDouble() > (*it).m_value.pattern().toDouble()))
accept = true;
break;
default:
break;
}
}
return accept;
}
bool AdvancedSortFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
bool accept = true;
const QList<Filter>& andList = m_currentFilter.andList();
const QList<Filter>& orList = m_currentFilter.orList();
QList<Filter>::const_iterator it;
QModelIndex index;
for (it = andList.begin(); it != andList.end(); it++)
{
index = sourceModel()->index(sourceRow, (*it).m_column, sourceParent);
switch ((*it).m_action)
{
case FilterAction_Has:
if (sourceModel()->data(index).toString().contains((*it).m_value) == false)
accept = false;
break;
case FilterAction_Is:
if ((sourceModel()->data(index).toString() == (*it).m_value.pattern()) == false)
accept = false;
break;
case FilterAction_LessThan:
if ((sourceModel()->data(index).toDouble() < (*it).m_value.pattern().toDouble()) == false)
accept = false;
break;
case FilterAction_MoreThan:
if ((sourceModel()->data(index).toDouble() > (*it).m_value.pattern().toDouble()) == false)
accept = false;
break;
default:
break;
}
}
for (it = orList.begin(); it != orList.end(); it++)
{
index = sourceModel()->index(sourceRow, (*it).m_column, sourceParent);
switch ((*it).m_action)
{
case FilterAction_Has:
if (sourceModel()->data(index).toString().contains((*it).m_value))
accept = true;
break;
case FilterAction_Is:
if ((sourceModel()->data(index).toString() == (*it).m_value.pattern()))
accept = true;
break;
case FilterAction_LessThan:
if ((sourceModel()->data(index).toDouble() < (*it).m_value.pattern().toDouble()))
accept = true;
break;
case FilterAction_MoreThan:
if ((sourceModel()->data(index).toDouble() > (*it).m_value.pattern().toDouble()))
accept = true;
break;
default:
break;
}
}
return accept;
}
To copy to clipboard, switch view to plain text mode
I know it could be better, i.e. to use QString in the filter and convert it to QRegExp if needed, not the other way around, also, the if's themselves are not quite needed.
But i don't really see, what can cause that behaviour that i described previously...
Bookmarks