mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-05 07:45:32 +00:00
Fixed problem in the idtable.
This commit is contained in:
parent
3262f8d774
commit
d221486a14
2 changed files with 28 additions and 15 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "idtable.hpp"
|
#include "idtable.hpp"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
@ -93,20 +94,31 @@ QVariant CSMWorld::IdTable::nestedHeaderData(int section, int subSection, Qt::Or
|
||||||
|
|
||||||
bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value, int role)
|
bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value, int role)
|
||||||
{
|
{
|
||||||
if (mIdCollection->getColumn (index.column()).isEditable() && role==Qt::EditRole)
|
if (index.internalId() != 0)
|
||||||
{
|
{
|
||||||
if (index.internalId() == 0)
|
if (mIdCollection->getColumn(parent(index).column()).isEditable() && role==Qt::EditRole)
|
||||||
|
{
|
||||||
|
const std::pair<int, int>& parentAdress(unfoldIndexAdress(index.internalId()));
|
||||||
|
|
||||||
|
mIdCollection->setNestedData(parentAdress.first, parentAdress.second, value, index.row(), index.column());
|
||||||
|
|
||||||
|
emit dataChanged (CSMWorld::IdTable::index (parentAdress.first, 0),
|
||||||
|
CSMWorld::IdTable::index (parentAdress.second, mIdCollection->getColumns()-1));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mIdCollection->getColumn (index.column()).isEditable() && role==Qt::EditRole)
|
||||||
{
|
{
|
||||||
mIdCollection->setData (index.row(), index.column(), value);
|
mIdCollection->setData (index.row(), index.column(), value);
|
||||||
|
|
||||||
emit dataChanged (CSMWorld::IdTable::index (index.row(), 0),
|
emit dataChanged (CSMWorld::IdTable::index (index.row(), 0),
|
||||||
CSMWorld::IdTable::index (index.row(), mIdCollection->getColumns()-1));
|
CSMWorld::IdTable::index (index.row(), mIdCollection->getColumns()-1));
|
||||||
} else
|
|
||||||
{
|
|
||||||
const std::pair<int, int>& parentAdress(unfoldIndexAdress(index.internalId()));
|
|
||||||
|
|
||||||
mIdCollection->setNestedData(parentAdress.first, parentAdress.second, value, index.row(), index.column());
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
CSVWorld::NestedTable::NestedTable(QUndoStack& undoStack,
|
||||||
CSMWorld::NestedTableModel* model,
|
CSMWorld::NestedTableModel* model,
|
||||||
|
|
Loading…
Reference in a new issue