Ref T472, allow to pass already existing values for model parsing

* list to map: toDbKeyValueMap
* categories can also be passed, hence the categories can be seen in model views
This commit is contained in:
Klaus Basan
2019-02-19 23:54:14 +01:00
committed by Mat Sutcliffe
parent 7a2ed1433d
commit 9cee34f4cc
7 changed files with 53 additions and 12 deletions

View File

@@ -119,6 +119,18 @@ namespace BlackMisc
return keys;
}
template <class OBJ, class CONTAINER, typename KEYTYPE>
QMap<KEYTYPE, OBJ> IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::toDbKeyValueMap() const
{
QMap<KEYTYPE, OBJ> map;
for (const OBJ &obj : ITimestampObjectList<OBJ, CONTAINER>::container())
{
if (!obj.hasValidDbKey()) { continue; }
map.insert(obj.getDbKey(), obj);
}
return map;
}
template<class OBJ, class CONTAINER, typename KEYTYPE>
QSet<QString> IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::toDbKeyStringSet() const
{