From 64673ef1f9936eb9b25fafb860852ca4c347d2fd Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 3 Dec 2018 05:52:45 +0100 Subject: 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. --- mappingtreemodel.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'mappingtreemodel.cpp') 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 MappingTreeModel::siblingMappingDataFromId(int id){ + QSqlQuery q(mDb); + QList 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; -- cgit v1.2.3-70-g09d2