mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-13 07:14:31 +00:00
handle dragging not-existing records
This commit is contained in:
parent
18fc8acc71
commit
d376efe30b
@ -27,6 +27,7 @@ namespace CSMWorld
|
|||||||
enum Display
|
enum Display
|
||||||
{
|
{
|
||||||
Display_None, //Do not use
|
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_String,
|
||||||
Display_LongString,
|
Display_LongString,
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ std::string CSMWorld::TableMimeData::getIcon() const
|
|||||||
{
|
{
|
||||||
if (mUniversalId.empty())
|
if (mUniversalId.empty())
|
||||||
{
|
{
|
||||||
throw ("TableMimeData holds no UniversalId");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string tmpIcon;
|
std::string tmpIcon;
|
||||||
@ -360,6 +360,8 @@ CSMWorld::UniversalId::Type CSMWorld::TableMimeData::convertEnums (CSMWorld::Col
|
|||||||
case CSMWorld::ColumnBase::Display_Script:
|
case CSMWorld::ColumnBase::Display_Script:
|
||||||
return CSMWorld::UniversalId::Type_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:
|
default:
|
||||||
return CSMWorld::UniversalId::Type_None;
|
return CSMWorld::UniversalId::Type_None;
|
||||||
@ -375,6 +377,10 @@ CSMWorld::ColumnBase::Display CSMWorld::TableMimeData::convertEnums (CSMWorld::U
|
|||||||
return CSMWorld::ColumnBase::Display_Race;
|
return CSMWorld::ColumnBase::Display_Race;
|
||||||
|
|
||||||
|
|
||||||
|
case CSMWorld::UniversalId::Type_Cell_Missing:
|
||||||
|
return CSMWorld::ColumnBase::Display_Cell_Missing;
|
||||||
|
|
||||||
|
|
||||||
case CSMWorld::UniversalId::Type_Skill:
|
case CSMWorld::UniversalId::Type_Skill:
|
||||||
return CSMWorld::ColumnBase::Display_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_TopicInfo, "TopicInfo", 0 },
|
||||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_JournalInfo, "JournalInfo", 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, "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_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_Activator, "Activator", ":./activator.png" },
|
||||||
{ CSMWorld::UniversalId::Class_RefRecord, CSMWorld::UniversalId::Type_Potion, "Potion", ":./potion.png" },
|
{ CSMWorld::UniversalId::Class_RefRecord, CSMWorld::UniversalId::Type_Potion, "Potion", ":./potion.png" },
|
||||||
|
@ -60,6 +60,7 @@ namespace CSMWorld
|
|||||||
Type_Spell,
|
Type_Spell,
|
||||||
Type_Cells,
|
Type_Cells,
|
||||||
Type_Cell,
|
Type_Cell,
|
||||||
|
Type_Cell_Missing, //For cells that does not exist yet.
|
||||||
Type_Referenceables,
|
Type_Referenceables,
|
||||||
Type_Referenceable,
|
Type_Referenceable,
|
||||||
Type_Activator,
|
Type_Activator,
|
||||||
|
@ -353,13 +353,21 @@ void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
|
|||||||
|
|
||||||
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDragedRecords() const
|
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDragedRecords() const
|
||||||
{
|
{
|
||||||
QModelIndexList selected = getSelectedCells();
|
QModelIndexList selected(getSelectedCells(true, false));
|
||||||
std::vector<CSMWorld::UniversalId> ids;
|
std::vector<CSMWorld::UniversalId> ids;
|
||||||
foreach (QModelIndex it, selected)
|
foreach (QModelIndex it, selected)
|
||||||
{
|
{
|
||||||
ids.push_back(
|
ids.push_back(
|
||||||
CSMWorld::UniversalId
|
CSMWorld::UniversalId(
|
||||||
(CSMWorld::UniversalId::Type_Cell,
|
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()));
|
model()->data(it, CSMWorld::RegionMap::Role_CellId).toString().toUtf8().constData()));
|
||||||
}
|
}
|
||||||
return ids;
|
return ids;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user