MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / data

Method data

pcsx2-qt/Debugger/SymbolTree/SymbolTreeModel.cpp:95–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95QVariant SymbolTreeModel::data(const QModelIndex& index, int role) const
96{
97 if (!index.isValid())
98 return QVariant();
99
100 SymbolTreeNode* node = nodeFromIndex(index);
101 if (!node)
102 return QVariant();
103
104 if (role == Qt::ForegroundRole)
105 {
106 bool active = true;
107
108 // Gray out the names of symbols that have been overwritten in memory.
109 if (index.column() == NAME)
110 active = node->matchesMemory();
111
112 // Gray out the values of variables that are dead.
113 if (index.column() == VALUE && node->liveness().has_value())
114 active = *node->liveness();
115
116 QPalette::ColorGroup group = active ? QPalette::Active : QPalette::Disabled;
117 return QBrush(QApplication::palette().color(group, QPalette::Text));
118 }
119
120 if (role != Qt::DisplayRole)
121 return QVariant();
122
123 switch (index.column())
124 {
125 case NAME:
126 {
127 return node->name;
128 }
129 case VALUE:
130 {
131 if (node->tag != SymbolTreeNode::OBJECT)
132 return QVariant();
133
134 return node->display_value();
135 }
136 case LOCATION:
137 {
138 return node->location.toString(m_cpu).rightJustified(8);
139 }
140 case SIZE:
141 {
142 if (!node->size.has_value())
143 return QVariant();
144
145 return QString::number(*node->size);
146 }
147 case TYPE:
148 {
149 QVariant result;
150 m_cpu.GetSymbolGuardian().Read([&](const ccc::SymbolDatabase& database) -> void {
151 const ccc::ast::Node* type = node->type.lookup_node(database);
152 if (!type)

Callers 1

stringToTypeFunction · 0.45

Calls 9

QVariantClass · 0.85
typeToStringFunction · 0.85
isValidMethod · 0.80
matchesMemoryMethod · 0.80
livenessMethod · 0.80
colorMethod · 0.80
lookup_nodeMethod · 0.80
toStringMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected