mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 07:45:31 +00:00
TableEditIdAction: prevent creation of a UniversalId with Type_None
This commit is contained in:
parent
09a95f276f
commit
bcd0f0f4e4
1 changed files with 11 additions and 4 deletions
|
@ -25,9 +25,13 @@ CSVWorld::TableEditIdAction::TableEditIdAction(const QTableView &table, QWidget
|
||||||
void CSVWorld::TableEditIdAction::setCell(int row, int column)
|
void CSVWorld::TableEditIdAction::setCell(int row, int column)
|
||||||
{
|
{
|
||||||
CellData data = getCellData(row, column);
|
CellData data = getCellData(row, column);
|
||||||
mCurrentId = CSMWorld::UniversalId(CSMWorld::TableMimeData::convertEnums(data.first),
|
CSMWorld::UniversalId::Type idType = CSMWorld::TableMimeData::convertEnums(data.first);
|
||||||
data.second.toUtf8().constData());
|
|
||||||
setText("Edit '" + data.second + "'");
|
if (idType != CSMWorld::UniversalId::Type_None)
|
||||||
|
{
|
||||||
|
mCurrentId = CSMWorld::UniversalId(idType, data.second.toUtf8().constData());
|
||||||
|
setText("Edit '" + data.second + "'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMWorld::UniversalId CSVWorld::TableEditIdAction::getCurrentId() const
|
CSMWorld::UniversalId CSVWorld::TableEditIdAction::getCurrentId() const
|
||||||
|
@ -38,5 +42,8 @@ CSMWorld::UniversalId CSVWorld::TableEditIdAction::getCurrentId() const
|
||||||
bool CSVWorld::TableEditIdAction::isValidIdCell(int row, int column) const
|
bool CSVWorld::TableEditIdAction::isValidIdCell(int row, int column) const
|
||||||
{
|
{
|
||||||
CellData data = getCellData(row, column);
|
CellData data = getCellData(row, column);
|
||||||
return CSMWorld::ColumnBase::isId(data.first) && !data.second.isEmpty();
|
CSMWorld::UniversalId::Type idType = CSMWorld::TableMimeData::convertEnums(data.first);
|
||||||
|
return CSMWorld::ColumnBase::isId(data.first) &&
|
||||||
|
idType != CSMWorld::UniversalId::Type_None &&
|
||||||
|
!data.second.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue