| 154 | } |
| 155 | |
| 156 | void ProjectTree::appendRootItem(QStandardItem *root) |
| 157 | { |
| 158 | if (!root) |
| 159 | return; |
| 160 | |
| 161 | // 发送工程创建信号 |
| 162 | using namespace dpfservice; |
| 163 | auto info = ProjectInfo::get(ProjectGenerator::root(root)); |
| 164 | |
| 165 | // 添加工程节点 |
| 166 | QStandardItemModel *model = static_cast<QStandardItemModel *>(DTreeView::model()); |
| 167 | if (model) |
| 168 | model->appendRow(root); |
| 169 | |
| 170 | if (root->data(Project::ParsingStateRole).value<Project::ParsingState>() != Project::Done) //avoid appent root item after complete parse |
| 171 | root->setData(Project::Wait, Project::ParsingStateRole); |
| 172 | |
| 173 | // 发送工程节点已创建信号 |
| 174 | SendEvents::projectCreated(info); |
| 175 | |
| 176 | // 激活当前工程节点 |
| 177 | doActiveProject(root); |
| 178 | } |
| 179 | |
| 180 | void ProjectTree::removeRootItem(QStandardItem *root) |
| 181 | { |