bool uoMetaModel::deleteNode(uoMetaNode *pNode, const QModelIndex &index){ if(!index.isValid()) return false; const QModelIndex parent = index.parent(); uoMetaNode *ppNode = pNode->parent(); int row = ppNode->m_children.indexOf(pNode); m_lastInsertedNode = 0; beginRemoveRows(parent,row,row); ppNode->m_children.removeAt(row); endRemoveRows(); return true;}
C++ (Qt)template <class T>void RemoveByIndex( QVector <T> & data, QVector <int> & index, bool indexSorted ){ if (!indexSorted) qSort(index.begin(), index.end()); for (int i = 0; i < index.size(); ++i) data.erase(data.begin() + index[i] - i);}