mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 02:42:55 +00:00
fix regression since cd5217cdbc
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8062cae02e
commit
3b2f367497
1 changed files with 8 additions and 15 deletions
|
@ -2039,7 +2039,6 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||||
Qt::MatchFlags flags) const
|
Qt::MatchFlags flags) const
|
||||||
{
|
{
|
||||||
QModelIndexList result;
|
QModelIndexList result;
|
||||||
uint matchType = flags & 0x0F;
|
|
||||||
Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
|
Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
|
||||||
bool recurse = flags & Qt::MatchRecursive;
|
bool recurse = flags & Qt::MatchRecursive;
|
||||||
bool wrap = flags & Qt::MatchWrap;
|
bool wrap = flags & Qt::MatchWrap;
|
||||||
|
@ -2057,36 +2056,30 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||||
continue;
|
continue;
|
||||||
QVariant v = data(idx, role);
|
QVariant v = data(idx, role);
|
||||||
// QVariant based matching
|
// QVariant based matching
|
||||||
if (matchType == Qt::MatchExactly) {
|
if (flags & Qt::MatchExactly) {
|
||||||
if (value == v)
|
if (value == v)
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
} else { // QString based matching
|
} else { // QString based matching
|
||||||
if (text.isEmpty()) // lazy conversion
|
if (text.isEmpty()) // lazy conversion
|
||||||
text = value.toString();
|
text = value.toString();
|
||||||
QString t = v.toString();
|
QString t = v.toString();
|
||||||
switch (matchType) {
|
if (flags & Qt::MatchRegExp) {
|
||||||
case Qt::MatchRegExp:
|
|
||||||
if (QRegExp(text, cs).exactMatch(t))
|
if (QRegExp(text, cs).exactMatch(t))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
} else if (flags & Qt::MatchWildcard) {
|
||||||
case Qt::MatchWildcard:
|
|
||||||
if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
|
if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
} else if (flags & Qt::MatchStartsWith) {
|
||||||
case Qt::MatchStartsWith:
|
|
||||||
if (t.startsWith(text, cs))
|
if (t.startsWith(text, cs))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
} else if (flags & Qt::MatchEndsWith) {
|
||||||
case Qt::MatchEndsWith:
|
|
||||||
if (t.endsWith(text, cs))
|
if (t.endsWith(text, cs))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
} else if (flags & Qt::MatchFixedString) {
|
||||||
case Qt::MatchFixedString:
|
|
||||||
if (t.compare(text, cs) == 0)
|
if (t.compare(text, cs) == 0)
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
break;
|
} else {
|
||||||
case Qt::MatchContains:
|
// Qt::MatchContains:
|
||||||
default:
|
|
||||||
if (t.contains(text, cs))
|
if (t.contains(text, cs))
|
||||||
result.append(idx);
|
result.append(idx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue