Public Member Functions | |
| QxtModelFilterPrivate (const QVariant &value=QVariant(), const int role=Qt::DisplayRole, const Qt::MatchFlags flags=Qt::MatchContains) | |
| bool | acceptsValue (const QVariant &value) |
Public Attributes | |
| QVariant | m_value |
| int | m_role |
| Qt::MatchFlags | m_flags |
Definition at line 45 of file qxtsortfilterproxymodel.cpp.
| QxtModelFilterPrivate::QxtModelFilterPrivate | ( | const QVariant & | value = QVariant(), |
| const int | role = Qt::DisplayRole, |
||
| const Qt::MatchFlags | flags = Qt::MatchContains |
||
| ) |
Definition at line 62 of file qxtsortfilterproxymodel.cpp.
| bool QxtModelFilterPrivate::acceptsValue | ( | const QVariant & | value ) |
Definition at line 68 of file qxtsortfilterproxymodel.cpp.
References m_flags, and m_value.
Referenced by QxtSortFilterProxyModel::filterAcceptsRow().
{
uint matchType = m_flags & 0x0F;
//if we have no value we accept everything
if(!m_value.isValid() || !value.isValid())
return true;
// QVariant based matching
if (matchType == Qt::MatchExactly ){
if(m_value == value)
return true;
}
// QString based matching
else {
Qt::CaseSensitivity cs = m_flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
QString filterText = m_value.toString();
QString modelText = value.toString();
switch (matchType){
case Qt::MatchRegExp:
if (QRegExp(filterText, cs).exactMatch(modelText))
return true;
break;
case Qt::MatchWildcard:
if (QRegExp(filterText, cs, QRegExp::Wildcard).exactMatch(modelText))
return true;
break;
case Qt::MatchStartsWith:
if (modelText.startsWith(filterText, cs))
return true;
break;
case Qt::MatchEndsWith:
if (modelText.endsWith(filterText, cs))
return true;
break;
case Qt::MatchFixedString:
if (modelText.compare(filterText, cs) == 0)
return true;
break;
default:
case Qt::MatchContains:
if (modelText.contains(filterText, cs))
return true;
}
}
return false;
}
| Qt::MatchFlags QxtModelFilterPrivate::m_flags |
Definition at line 52 of file qxtsortfilterproxymodel.cpp.
Referenced by acceptsValue().
Definition at line 51 of file qxtsortfilterproxymodel.cpp.
Referenced by QxtSortFilterProxyModel::filterAcceptsRow().
| QVariant QxtModelFilterPrivate::m_value |
Definition at line 50 of file qxtsortfilterproxymodel.cpp.
Referenced by acceptsValue().
1.7.2