forked from teamnwah/openmw-tes3coop
handle dragging not-existing records
This commit is contained in:
parent
18fc8acc71
commit
d376efe30b
5 changed files with 21 additions and 4 deletions
|
@ -27,6 +27,7 @@ namespace CSMWorld
|
|||
enum Display
|
||||
{
|
||||
Display_None, //Do not use
|
||||
Display_Cell_Missing, //Do not used, actually. It is here to simplify dragging non-existed cells handling
|
||||
Display_String,
|
||||
Display_LongString,
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ std::string CSMWorld::TableMimeData::getIcon() const
|
|||
{
|
||||
if (mUniversalId.empty())
|
||||
{
|
||||
throw ("TableMimeData holds no UniversalId");
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string tmpIcon;
|
||||
|
@ -360,6 +360,8 @@ CSMWorld::UniversalId::Type CSMWorld::TableMimeData::convertEnums (CSMWorld::Col
|
|||
case CSMWorld::ColumnBase::Display_Script:
|
||||
return CSMWorld::UniversalId::Type_Script;
|
||||
|
||||
case CSMWorld::ColumnBase::Display_Cell_Missing:
|
||||
return CSMWorld::UniversalId::Type_Cell_Missing; //this one actually never happens, since there is no display_Cell_missing column anywhere.
|
||||
|
||||
default:
|
||||
return CSMWorld::UniversalId::Type_None;
|
||||
|
@ -375,6 +377,10 @@ CSMWorld::ColumnBase::Display CSMWorld::TableMimeData::convertEnums (CSMWorld::U
|
|||
return CSMWorld::ColumnBase::Display_Race;
|
||||
|
||||
|
||||
case CSMWorld::UniversalId::Type_Cell_Missing:
|
||||
return CSMWorld::ColumnBase::Display_Cell_Missing;
|
||||
|
||||
|
||||
case CSMWorld::UniversalId::Type_Skill:
|
||||
return CSMWorld::ColumnBase::Display_Skill;
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace
|
|||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_TopicInfo, "TopicInfo", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_JournalInfo, "JournalInfo", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Cell, "Cell", ":./cell.png" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Cell_Missing, "Cell", ":./cell.png" },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Referenceable, "Referenceables", 0 },
|
||||
{ CSMWorld::UniversalId::Class_RefRecord, CSMWorld::UniversalId::Type_Activator, "Activator", ":./activator.png" },
|
||||
{ CSMWorld::UniversalId::Class_RefRecord, CSMWorld::UniversalId::Type_Potion, "Potion", ":./potion.png" },
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace CSMWorld
|
|||
Type_Spell,
|
||||
Type_Cells,
|
||||
Type_Cell,
|
||||
Type_Cell_Missing, //For cells that does not exist yet.
|
||||
Type_Referenceables,
|
||||
Type_Referenceable,
|
||||
Type_Activator,
|
||||
|
|
|
@ -353,13 +353,21 @@ void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
|
|||
|
||||
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDragedRecords() const
|
||||
{
|
||||
QModelIndexList selected = getSelectedCells();
|
||||
QModelIndexList selected(getSelectedCells(true, false));
|
||||
std::vector<CSMWorld::UniversalId> ids;
|
||||
foreach (QModelIndex it, selected)
|
||||
{
|
||||
ids.push_back(
|
||||
CSMWorld::UniversalId
|
||||
(CSMWorld::UniversalId::Type_Cell,
|
||||
CSMWorld::UniversalId(
|
||||
CSMWorld::UniversalId::Type_Cell,
|
||||
model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData()));
|
||||
}
|
||||
selected = getSelectedCells(false, true);
|
||||
foreach (QModelIndex it, selected)
|
||||
{
|
||||
ids.push_back(
|
||||
CSMWorld::UniversalId(
|
||||
CSMWorld::UniversalId::Type_Cell_Missing,
|
||||
model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData()));
|
||||
}
|
||||
return ids;
|
||||
|
|
Loading…
Reference in a new issue