forked from teamnwah/openmw-tes3coop
For bug #1710. Change the ID type of mime data for filterbox drop events to Referenceable rather than using the ID's native type.
This commit is contained in:
parent
e315a72582
commit
4a8fe39b2c
3 changed files with 25 additions and 3 deletions
|
@ -68,6 +68,26 @@ std::vector< CSMWorld::UniversalId > CSMWorld::TableMimeData::getData() const
|
|||
return mUniversalId;
|
||||
}
|
||||
|
||||
std::vector< CSMWorld::UniversalId > CSMWorld::TableMimeData::getRefTypeData() const
|
||||
{
|
||||
std::vector<CSMWorld::UniversalId> ref_data;
|
||||
|
||||
std::vector<CSMWorld::UniversalId>::const_iterator it = mUniversalId.begin();
|
||||
for(; it != mUniversalId.end(); ++it)
|
||||
{
|
||||
if(isReferencable(it->getType()))
|
||||
{
|
||||
// change the type
|
||||
ref_data.push_back(CSMWorld::UniversalId(
|
||||
CSMWorld::UniversalId::Type_Referenceable, it->getId()));
|
||||
}
|
||||
else
|
||||
ref_data.push_back(*it);
|
||||
}
|
||||
|
||||
return ref_data;
|
||||
}
|
||||
|
||||
bool CSMWorld::TableMimeData::isReferencable(CSMWorld::ColumnBase::Display type) const
|
||||
{
|
||||
return ( type == CSMWorld::ColumnBase::Display_Activator
|
||||
|
@ -222,7 +242,6 @@ namespace
|
|||
{ CSMWorld::UniversalId::Type_Race, CSMWorld::ColumnBase::Display_Race },
|
||||
{ CSMWorld::UniversalId::Type_Skill, CSMWorld::ColumnBase::Display_Skill },
|
||||
{ CSMWorld::UniversalId::Type_Class, CSMWorld::ColumnBase::Display_Class },
|
||||
{ CSMWorld::UniversalId::Type_Class, CSMWorld::ColumnBase::Display_Class },
|
||||
{ CSMWorld::UniversalId::Type_Faction, CSMWorld::ColumnBase::Display_Faction },
|
||||
{ CSMWorld::UniversalId::Type_Sound, CSMWorld::ColumnBase::Display_Sound },
|
||||
{ CSMWorld::UniversalId::Type_Region, CSMWorld::ColumnBase::Display_Region },
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace CSMWorld
|
|||
|
||||
std::vector<UniversalId> getData() const;
|
||||
|
||||
// change Id type to Type_Referenceable where possible
|
||||
std::vector<UniversalId> getRefTypeData() const;
|
||||
|
||||
bool holdsType(UniversalId::Type type) const;
|
||||
|
||||
bool holdsType(CSMWorld::ColumnBase::Display type) const;
|
||||
|
@ -65,4 +68,4 @@ namespace CSMWorld
|
|||
|
||||
};
|
||||
}
|
||||
#endif // TABLEMIMEDATA_H
|
||||
#endif // TABLEMIMEDATA_H
|
||||
|
|
|
@ -39,7 +39,7 @@ void CSVFilter::FilterBox::dropEvent (QDropEvent* event)
|
|||
if (!mime) // May happen when non-records (e.g. plain text) are dragged and dropped
|
||||
return;
|
||||
|
||||
std::vector<CSMWorld::UniversalId> data = mime->getData();
|
||||
std::vector<CSMWorld::UniversalId> data = mime->getRefTypeData();
|
||||
|
||||
emit recordDropped(data, event->proposedAction());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue