forked from mirror/openmw-tes3mp
Rows with the same topic but in different letter case can be reordered
This commit is contained in:
parent
ced4e237a8
commit
21f0b586ec
2 changed files with 17 additions and 7 deletions
|
@ -97,7 +97,8 @@ bool CSMWorld::InfoCollection::reorderRows (int baseIndex, const std::vector<int
|
|||
return false;
|
||||
|
||||
// Check that topics match
|
||||
if (getRecord (baseIndex).get().mTopicId!=getRecord (lastIndex).get().mTopicId)
|
||||
if (!Misc::StringUtils::ciEqual(getRecord(baseIndex).get().mTopicId,
|
||||
getRecord(lastIndex).get().mTopicId))
|
||||
return false;
|
||||
|
||||
// reorder
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <QString>
|
||||
#include <QtCore/qnamespace.h>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
|
||||
#include "../../model/world/data.hpp"
|
||||
|
@ -128,17 +130,24 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|||
{
|
||||
int row = mProxyModel->mapToSource (
|
||||
mProxyModel->index (selectedRows.begin()->row(), 0)).row();
|
||||
QString curData = mModel->data(mModel->index(row, column)).toString();
|
||||
|
||||
if (row>0 && mModel->data (mModel->index (row, column))==
|
||||
mModel->data (mModel->index (row-1, column)))
|
||||
if (row > 0)
|
||||
{
|
||||
menu.addAction (mMoveUpAction);
|
||||
QString prevData = mModel->data(mModel->index(row - 1, column)).toString();
|
||||
if (Misc::StringUtils::ciEqual(curData.toStdString(), prevData.toStdString()))
|
||||
{
|
||||
menu.addAction(mMoveUpAction);
|
||||
}
|
||||
}
|
||||
|
||||
if (row<mModel->rowCount()-1 && mModel->data (mModel->index (row, column))==
|
||||
mModel->data (mModel->index (row+1, column)))
|
||||
if (row < mModel->rowCount() - 1)
|
||||
{
|
||||
menu.addAction (mMoveDownAction);
|
||||
QString nextData = mModel->data(mModel->index(row + 1, column)).toString();
|
||||
if (Misc::StringUtils::ciEqual(curData.toStdString(), nextData.toStdString()))
|
||||
{
|
||||
menu.addAction(mMoveDownAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue