| 963 | } |
| 964 | |
| 965 | void MemWatchModel::updateStructNode(MemWatchTreeNode* node) |
| 966 | { |
| 967 | const QString structName = node->getEntry()->getStructName(); |
| 968 | |
| 969 | if (!m_structDefMap.contains(structName) || m_structDefMap[structName]->getFields().isEmpty()) |
| 970 | { |
| 971 | while (node->hasChildren()) |
| 972 | deleteNode(getIndexFromTreeNode(node->getChildren()[0])); |
| 973 | return; |
| 974 | } |
| 975 | |
| 976 | bool isExpanded{node->isExpanded()}; |
| 977 | |
| 978 | if (!node->hasChildren()) |
| 979 | { |
| 980 | addNodes({new MemWatchTreeNode(new MemWatchEntry(m_placeholderEntry))}, |
| 981 | getIndexFromTreeNode(node), true); |
| 982 | } |
| 983 | else if (node->hasChildren() && isExpanded) |
| 984 | { |
| 985 | // Shortcut for deleting all children and adding the placeholder child. Also overrides expanded |
| 986 | // state, so need to capture above and use below |
| 987 | collapseStructNode(node); |
| 988 | } |
| 989 | |
| 990 | if (isExpanded) |
| 991 | { |
| 992 | if (m_structDefMap.contains(structName)) |
| 993 | expandStructNode(node); |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | void MemWatchModel::expandContainerNode(MemWatchTreeNode* node) |
| 998 | { |
nothing calls this directly
no test coverage detected