| 157 | } |
| 158 | |
| 159 | void SortRDWidgetItems(QVector<RDTreeWidgetItem *> &members) |
| 160 | { |
| 161 | // Sort the children by offset, then global source var index, then by text. |
| 162 | // Using the global source var index allows resource arrays to be presented in index order |
| 163 | // rather than by name, so for example arr[2] comes before arr[10] |
| 164 | std::sort(members.begin(), members.end(), [](const RDTreeWidgetItem *a, const RDTreeWidgetItem *b) { |
| 165 | VariableTag at = a->tag().value<VariableTag>(); |
| 166 | VariableTag bt = b->tag().value<VariableTag>(); |
| 167 | if(at.offset != bt.offset) |
| 168 | return at.offset < bt.offset; |
| 169 | if(at.globalSourceVar && bt.globalSourceVar) |
| 170 | return at.sourceVarIdx < bt.sourceVarIdx; |
| 171 | return a->text(0) < b->text(0); |
| 172 | }); |
| 173 | } |
| 174 | |
| 175 | struct AccessedResourceTag |
| 176 | { |
no test coverage detected