| 106 | } |
| 107 | |
| 108 | std::list<std::string> getNodeChildren(const std::string& parentId) const |
| 109 | { |
| 110 | std::list<std::string> children; |
| 111 | if (parentId.empty()) { |
| 112 | if (this->dataSource_->modelRoot() != NULL) { |
| 113 | QPersistentModelIndex pindex(this->model_->index(this->dataSource_->modelRoot(), 0)); |
| 114 | this->nodeIndexes_.insert(pindex); |
| 115 | |
| 116 | // Convert uint64 internal id to string. |
| 117 | QString qstr = QString::number(pindex.internalId()); |
| 118 | |
| 119 | children.push_back(qstr.toLocal8Bit().constData()); |
| 120 | } |
| 121 | } else { |
| 122 | TreeNode* parentNode = getNode(parentId); |
| 123 | if (parentNode != NULL) { |
| 124 | QList<TreeNode*> childNodes = parentNode->children(); |
| 125 | for (int i = 0; i < childNodes.count(); ++i) { |
| 126 | QPersistentModelIndex pindex(this->model_->index(childNodes[i], 0)); |
| 127 | this->nodeIndexes_.insert(pindex); |
| 128 | |
| 129 | // Convert uint64 internal id to string. |
| 130 | QString qstr = QString::number(pindex.internalId()); |
| 131 | |
| 132 | children.push_back(qstr.toLocal8Bit().constData()); |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | return children; |
| 137 | } |
| 138 | |
| 139 | typedef std::set<QPersistentModelIndex> IndexList; |
| 140 | |