mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:06:45 +00:00
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 "infotableproxymodel.hpp"
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include "idtablebase.hpp"
|
#include "idtablebase.hpp"
|
||||||
#include "columns.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)
|
CSMWorld::InfoTableProxyModel::InfoTableProxyModel(CSMWorld::UniversalId::Type type, QObject *parent)
|
||||||
: IdTableProxyModel(parent),
|
: IdTableProxyModel(parent),
|
||||||
mType(type),
|
mType(type),
|
||||||
|
@ -45,7 +55,7 @@ int CSMWorld::InfoTableProxyModel::getFirstInfoRow(int currentRow) const
|
||||||
}
|
}
|
||||||
|
|
||||||
int column = mSourceModel->findColumnIndex(columnId);
|
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))
|
if (mFirstRowCache.contains(info))
|
||||||
{
|
{
|
||||||
|
@ -53,10 +63,11 @@ int CSMWorld::InfoTableProxyModel::getFirstInfoRow(int currentRow) const
|
||||||
}
|
}
|
||||||
|
|
||||||
while (--currentRow >= 0 &&
|
while (--currentRow >= 0 &&
|
||||||
mSourceModel->data(mSourceModel->index(currentRow, column)) == info);
|
toLower(mSourceModel->data(mSourceModel->index(currentRow, column)).toString()) == info);
|
||||||
|
++currentRow;
|
||||||
|
|
||||||
mFirstRowCache[info] = currentRow + 1;
|
mFirstRowCache[info] = currentRow;
|
||||||
return currentRow + 1;
|
return currentRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::InfoTableProxyModel::modelRowsChanged(const QModelIndex &/*parent*/, int /*start*/, int /*end*/)
|
void CSMWorld::InfoTableProxyModel::modelRowsChanged(const QModelIndex &/*parent*/, int /*start*/, int /*end*/)
|
||||||
|
|
Loading…
Reference in a new issue