diff options
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 9650e77..25969cb 100644 --- a/mappingtreemodel.cpp +++ b/mappingtreemodel.cpp @@ -232,6 +232,22 @@ bool MappingTreeModel::addChild(const QVariant &name, const QModelIndex &parent)      return false;  } +bool MappingTreeModel::renameChild(const QModelIndex &idx, const QString newName){ +    if(!idx.isValid()){ +        return false; +    } +    int descId = idx.data(DescIdRole).toInt(); +    QSqlQuery renameQ(mDb); +    renameQ.prepare("UPDATE mapping_description SET tdescription_name = :name WHERE idescription_id = :id"); +    renameQ.bindValue(":id", descId); +    renameQ.bindValue(":name", newName); +    if(renameQ.exec()){ +        populate(); +        return true; +    } +    return false; +} +  bool MappingTreeModel::deleteChild(const QModelIndex &idx){      if(!idx.isValid()){          return false; | 
