mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
fixed some proxy model problems related to column numbers
This commit is contained in:
parent
e4a37ef709
commit
302e2f8e9a
@ -36,8 +36,10 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|||||||
for (QModelIndexList::const_iterator iter (selectedRows.begin()); iter!=selectedRows.end();
|
for (QModelIndexList::const_iterator iter (selectedRows.begin()); iter!=selectedRows.end();
|
||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
records.push_back (mProxyModel->data (
|
int row = mProxyModel->mapToSource (mProxyModel->index (iter->row(), 0)).row();
|
||||||
mProxyModel->index (iter->row(), columnIndex)).toString().toUtf8().constData());
|
|
||||||
|
records.push_back (mModel->data (
|
||||||
|
mModel->index (row, columnIndex)).toString().toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
mDispatcher->setSelection (records);
|
mDispatcher->setSelection (records);
|
||||||
@ -71,8 +73,6 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|||||||
/// \todo allow reordering of multiple rows
|
/// \todo allow reordering of multiple rows
|
||||||
if (selectedRows.size()==1)
|
if (selectedRows.size()==1)
|
||||||
{
|
{
|
||||||
int row =selectedRows.begin()->row();
|
|
||||||
|
|
||||||
int column = mModel->searchColumnIndex (CSMWorld::Columns::ColumnId_Topic);
|
int column = mModel->searchColumnIndex (CSMWorld::Columns::ColumnId_Topic);
|
||||||
|
|
||||||
if (column==-1)
|
if (column==-1)
|
||||||
@ -80,14 +80,17 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|||||||
|
|
||||||
if (column!=-1)
|
if (column!=-1)
|
||||||
{
|
{
|
||||||
if (row>0 && mProxyModel->data (mProxyModel->index (row, column))==
|
int row = mProxyModel->mapToSource (
|
||||||
mProxyModel->data (mProxyModel->index (row-1, column)))
|
mProxyModel->index (selectedRows.begin()->row(), 0)).row();
|
||||||
|
|
||||||
|
if (row>0 && mModel->data (mModel->index (row, column))==
|
||||||
|
mModel->data (mModel->index (row-1, column)))
|
||||||
{
|
{
|
||||||
menu.addAction (mMoveUpAction);
|
menu.addAction (mMoveUpAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row<mProxyModel->rowCount()-1 && mProxyModel->data (mProxyModel->index (row, column))==
|
if (row<mModel->rowCount()-1 && mModel->data (mModel->index (row, column))==
|
||||||
mProxyModel->data (mProxyModel->index (row+1, column)))
|
mModel->data (mModel->index (row+1, column)))
|
||||||
{
|
{
|
||||||
menu.addAction (mMoveDownAction);
|
menu.addAction (mMoveDownAction);
|
||||||
}
|
}
|
||||||
@ -225,9 +228,11 @@ void CSVWorld::Table::setEditLock (bool locked)
|
|||||||
|
|
||||||
CSMWorld::UniversalId CSVWorld::Table::getUniversalId (int row) const
|
CSMWorld::UniversalId CSVWorld::Table::getUniversalId (int row) const
|
||||||
{
|
{
|
||||||
|
row = mProxyModel->mapToSource (mProxyModel->index (row, 0)).row();
|
||||||
|
|
||||||
return CSMWorld::UniversalId (
|
return CSMWorld::UniversalId (
|
||||||
static_cast<CSMWorld::UniversalId::Type> (mProxyModel->data (mProxyModel->index (row, 2)).toInt()),
|
static_cast<CSMWorld::UniversalId::Type> (mModel->data (mModel->index (row, 2)).toInt()),
|
||||||
mProxyModel->data (mProxyModel->index (row, 0)).toString().toUtf8().constData());
|
mModel->data (mModel->index (row, 0)).toString().toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::Table::editRecord()
|
void CSVWorld::Table::editRecord()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user