made record state uneditable again

This commit is contained in:
Marc Zinnschlag 2012-12-13 13:52:26 +01:00
parent 3d4c8c5444
commit 640c218df3
3 changed files with 25 additions and 1 deletions

View file

@ -66,6 +66,11 @@ namespace CSMWorld
{ {
return true; return true;
} }
virtual bool isUserEditable() const
{
return false;
}
}; };
template<typename ESXRecordT> template<typename ESXRecordT>

View file

@ -32,8 +32,17 @@ namespace CSMWorld
} }
virtual bool isEditable() const = 0; virtual bool isEditable() const = 0;
virtual bool isUserEditable() const;
///< Can this column be edited directly by the user?
}; };
template<typename ESXRecordT>
bool Column<ESXRecordT>::isUserEditable() const
{
return isEditable();
}
class IdCollectionBase class IdCollectionBase
{ {
// not implemented // not implemented
@ -62,6 +71,8 @@ namespace CSMWorld
virtual bool isEditable (int column) const = 0; virtual bool isEditable (int column) const = 0;
virtual bool isUserEditable (int column) const = 0;
virtual void merge() = 0; virtual void merge() = 0;
///< Merge modified into base. ///< Merge modified into base.
@ -129,6 +140,8 @@ namespace CSMWorld
virtual bool isEditable (int column) const; virtual bool isEditable (int column) const;
virtual bool isUserEditable (int column) const;
virtual void merge(); virtual void merge();
///< Merge modified into base. ///< Merge modified into base.
@ -250,6 +263,12 @@ namespace CSMWorld
return mColumns.at (column)->isEditable(); return mColumns.at (column)->isEditable();
} }
template<typename ESXRecordT>
bool IdCollection<ESXRecordT>::isUserEditable (int column) const
{
return mColumns.at (column)->isUserEditable();
}
template<typename ESXRecordT> template<typename ESXRecordT>
void IdCollection<ESXRecordT>::addColumn (Column<ESXRecordT> *column) void IdCollection<ESXRecordT>::addColumn (Column<ESXRecordT> *column)
{ {

View file

@ -70,7 +70,7 @@ Qt::ItemFlags CSMWorld::IdTable::flags (const QModelIndex & index) const
{ {
Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
if (mIdCollection->isEditable (index.column())) if (mIdCollection->isUserEditable (index.column()))
flags |= Qt::ItemIsEditable; flags |= Qt::ItemIsEditable;
return flags; return flags;