forked from mirror/openmw-tes3mp
InfoTableProxyModel: ignore the letter case in the search of the first Topic/Journal row
This commit is contained in:
parent
170692b480
commit
f1a38ffe93
1 changed files with 15 additions and 4 deletions
|
@ -1,8 +1,18 @@
|
|||
#include "infotableproxymodel.hpp"
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "idtablebase.hpp"
|
||||
#include "columns.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
QString toLower(const QString &str)
|
||||
{
|
||||
return Misc::StringUtils::lowerCase(str.toStdString()).c_str();
|
||||
}
|
||||
}
|
||||
|
||||
CSMWorld::InfoTableProxyModel::InfoTableProxyModel(CSMWorld::UniversalId::Type type, QObject *parent)
|
||||
: IdTableProxyModel(parent),
|
||||
mType(type),
|
||||
|
@ -45,7 +55,7 @@ int CSMWorld::InfoTableProxyModel::getFirstInfoRow(int currentRow) const
|
|||
}
|
||||
|
||||
int column = mSourceModel->findColumnIndex(columnId);
|
||||
QString info = mSourceModel->data(mSourceModel->index(currentRow, column)).toString();
|
||||
QString info = toLower(mSourceModel->data(mSourceModel->index(currentRow, column)).toString());
|
||||
|
||||
if (mFirstRowCache.contains(info))
|
||||
{
|
||||
|
@ -53,10 +63,11 @@ int CSMWorld::InfoTableProxyModel::getFirstInfoRow(int currentRow) const
|
|||
}
|
||||
|
||||
while (--currentRow >= 0 &&
|
||||
mSourceModel->data(mSourceModel->index(currentRow, column)) == info);
|
||||
toLower(mSourceModel->data(mSourceModel->index(currentRow, column)).toString()) == info);
|
||||
++currentRow;
|
||||
|
||||
mFirstRowCache[info] = currentRow + 1;
|
||||
return currentRow + 1;
|
||||
mFirstRowCache[info] = currentRow;
|
||||
return currentRow;
|
||||
}
|
||||
|
||||
void CSMWorld::InfoTableProxyModel::modelRowsChanged(const QModelIndex &/*parent*/, int /*start*/, int /*end*/)
|
||||
|
|
Loading…
Reference in a new issue