@ -108,6 +108,18 @@ Qt::ItemFlags CSMWorld::IdTree::flags (const QModelIndex & index) const
if (!index.isValid())
return 0;
if (index.internalId() != 0)
{
std::pair<int, int> parentAddress(unfoldIndexAddress(index.internalId()));
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
if (mNestedCollection->getNestableColumn(parentAddress.second)->nestedColumn(index.column()).isEditable())
flags |= Qt::ItemIsEditable;
return flags;
}
else
return IdTable::flags(index);
@ -110,7 +110,7 @@ bool CSMWorld::NestedTableProxyModel::setData (const QModelIndex & index, const
Qt::ItemFlags CSMWorld::NestedTableProxyModel::flags(const QModelIndex& index) const
return mMainModel->flags(mMainModel->index(0, mParentColumn));
return mMainModel->flags(mapToSource(index));
std::string CSMWorld::NestedTableProxyModel::getParentId() const
@ -120,7 +120,7 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM
QVariant new_ = hack.getData();
if (model->data (index)!=new_)
if ((model->data (index)!=new_) && (model->flags(index) & Qt::ItemIsEditable))
getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, new_));