forked from teamnwah/openmw-tes3coop
Added code to delete nestedRows
This commit is contained in:
parent
88c5288eaf
commit
c45061614b
9 changed files with 30 additions and 9 deletions
|
@ -47,3 +47,8 @@ int CSMWorld::CollectionBase::getNestedRowsCount(int row, int column) const
|
||||||
assert(false); //TODO, make pure abstract
|
assert(false); //TODO, make pure abstract
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMWorld::CollectionBase::removeNestedRows(int row, int column, int subRow)
|
||||||
|
{
|
||||||
|
assert(false); //todo, make pure abstract
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual void removeRows (int index, int count) = 0;
|
virtual void removeRows (int index, int count) = 0;
|
||||||
|
|
||||||
|
virtual void removeNestedRows(int row, int column, int subRow);
|
||||||
|
|
||||||
virtual void appendBlankRecord (const std::string& id,
|
virtual void appendBlankRecord (const std::string& id,
|
||||||
UniversalId::Type type = UniversalId::Type_None) = 0;
|
UniversalId::Type type = UniversalId::Type_None) = 0;
|
||||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||||
|
|
|
@ -126,7 +126,13 @@ Qt::ItemFlags CSMWorld::IdTable::flags (const QModelIndex & index) const
|
||||||
bool CSMWorld::IdTable::removeRows (int row, int count, const QModelIndex& parent)
|
bool CSMWorld::IdTable::removeRows (int row, int count, const QModelIndex& parent)
|
||||||
{
|
{
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return false;
|
{
|
||||||
|
for (int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
mIdCollection->removeNestedRows(parent.row(), parent.column(), row+i);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
beginRemoveRows (parent, row, row+count-1);
|
beginRemoveRows (parent, row, row+count-1);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual int getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const = 0;
|
virtual int getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const = 0;
|
||||||
|
|
||||||
virtual void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, unsigned rowToRemove) const = 0;
|
virtual void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, int rowToRemove) const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ QVariant CSMWorld::ContainerRefIdAdapter::getData (const RefIdColumn *column, co
|
||||||
return NameRefIdAdapter<ESM::Container>::getData (column, data, index);
|
return NameRefIdAdapter<ESM::Container>::getData (column, data, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::ContainerRefIdAdapter::removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, unsigned rowToRemove) const
|
void CSMWorld::ContainerRefIdAdapter::removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, int rowToRemove) const
|
||||||
{
|
{
|
||||||
assert(column==mContent);
|
assert(column==mContent);
|
||||||
|
|
||||||
|
@ -227,8 +227,6 @@ void CSMWorld::ContainerRefIdAdapter::removeNestedRow (const RefIdColumn *column
|
||||||
list.erase (list.begin () + rowToRemove);
|
list.erase (list.begin () + rowToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdData& data, int index,
|
||||||
const QVariant& value) const
|
const QVariant& value) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -634,8 +634,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual int getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const;
|
virtual int getNestedRowsCount(const RefIdColumn *column, const RefIdData& data, int index) const;
|
||||||
|
|
||||||
|
virtual void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, int rowToRemove) const;
|
||||||
virtual void removeNestedRow (const RefIdColumn *column, RefIdData& data, int index, unsigned rowToRemove) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CreatureColumns : public ActorColumns
|
struct CreatureColumns : public ActorColumns
|
||||||
|
|
|
@ -463,6 +463,15 @@ void CSMWorld::RefIdCollection::removeRows (int index, int count)
|
||||||
mData.erase (index, count);
|
mData.erase (index, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSMWorld::RefIdCollection::removeNestedRows(int row, int column, int subRow)
|
||||||
|
{
|
||||||
|
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (row);
|
||||||
|
|
||||||
|
const RefIdAdapter& adaptor = findAdaptor (localIndex.second);
|
||||||
|
|
||||||
|
dynamic_cast<const CSMWorld::NestedRefIdAdapter&>(adaptor).removeNestedRow(&mColumns.at (column), mData, localIndex.first, subRow);
|
||||||
|
}
|
||||||
|
|
||||||
void CSMWorld::RefIdCollection::appendBlankRecord (const std::string& id, UniversalId::Type type)
|
void CSMWorld::RefIdCollection::appendBlankRecord (const std::string& id, UniversalId::Type type)
|
||||||
{
|
{
|
||||||
mData.appendRecord (type, id, false);
|
mData.appendRecord (type, id, false);
|
||||||
|
|
|
@ -77,6 +77,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual void removeRows (int index, int count);
|
virtual void removeRows (int index, int count);
|
||||||
|
|
||||||
|
virtual void removeNestedRows(int row, int column, int subRow);
|
||||||
|
|
||||||
virtual void cloneRecord(const std::string& origin,
|
virtual void cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const UniversalId::Type type);
|
const UniversalId::Type type);
|
||||||
|
|
Loading…
Reference in a new issue