diff options
author | Arno <arno@disconnect.de> | 2018-12-03 05:52:45 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-12-03 05:52:45 +0100 |
commit | 64673ef1f9936eb9b25fafb860852ca4c347d2fd (patch) | |
tree | d0b92083cef1ad3606f75c6d86d1aede0f99dd71 /mappingtreemodel.cpp | |
parent | f9704767ed8bc325f9224c69b2dd18f564ee5cc0 (diff) | |
download | SheMov-64673ef1f9936eb9b25fafb860852ca4c347d2fd.tar.gz SheMov-64673ef1f9936eb9b25fafb860852ca4c347d2fd.tar.bz2 SheMov-64673ef1f9936eb9b25fafb860852ca4c347d2fd.zip |
Add copyActor for new pics
If we already have an actor, get all mappings for all pics and fill the
result view. This only makes sense for actors, but should also work for
other items.
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r-- | mappingtreemodel.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp index 2790ef7..4f253c5 100644 --- a/mappingtreemodel.cpp +++ b/mappingtreemodel.cpp @@ -231,6 +231,22 @@ MappingData MappingTreeModel::mappingDataFromIndex(QModelIndex &idx) const{ return mappingDataFromItem(item); } +QList<MappingData> MappingTreeModel::siblingMappingDataFromId(int id){ + QSqlQuery q(mDb); + QList<MappingData> retval; + q.prepare("SELECT DISTINCT(imappings_parents_id) FROM pics_mappings WHERE ipics_id IN (SELECT ipics_id FROM pics_mappings WHERE imappings_parents_id = :id)"); + q.bindValue(":id", id); + if(q.exec()){ + while(q.next()){ + QModelIndex idx = findRecursive(q.value(0), MappingId, rootIndex()); + if(idx.isValid()){ + retval << mappingDataFromIndex(idx); + } + } + } + return retval; +} + void MappingTreeModel::populate(){ if(mType == -1){ return; |