MCPcopy Create free account
hub / github.com/Vector35/debugger / data

Method data

ui/registerswidget.cpp:114–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112
113
114QVariant DebugRegistersListModel::data(const QModelIndex& index, int role) const
115{
116 if (index.column() >= columnCount() || (size_t)index.row() >= m_items.size())
117 return QVariant();
118
119 DebugRegisterItem* item = static_cast<DebugRegisterItem*>(index.internalPointer());
120 if (!item)
121 return QVariant();
122
123
124 if ((role != Qt::DisplayRole) && (role != Qt::SizeHintRole) && (role != SortFilterRole))
125 return QVariant();
126
127 switch (index.column())
128 {
129 case DebugRegistersListModel::NameColumn:
130 {
131 if (role == Qt::SizeHintRole)
132 return QVariant((qulonglong)item->name().size());
133
134 if (role == SortFilterRole)
135 return QVariant(QString::fromStdString(item->name()));
136
137 QList<QVariant> line;
138 line.push_back(getThemeColor(RegisterColor).rgba());
139 line.push_back(QString::fromStdString(item->name()));
140 return QVariant(line);
141 }
142 case DebugRegistersListModel::ValueColumn:
143 {
144 // TODO: We need better alignment for values
145 uint64_t value = item->value();
146 QString valueStr = QString::asprintf("0x%" PRIx64, value);
147 if (role == Qt::SizeHintRole)
148 return QVariant((qulonglong)valueStr.size());
149
150 if (role == SortFilterRole)
151 return QVariant(valueStr);
152
153 QList<QVariant> line;
154 switch (item->valueStatus())
155 {
156 case DebugRegisterValueNormal:
157 line.push_back(getThemeColor(AddressColor).rgba());
158 break;
159 case DebugRegisterValueChanged:
160 line.push_back(getThemeColor(RedStandardHighlightColor).rgba());
161 break;
162 case DebugRegisterValueModified:
163 line.push_back(getThemeColor(RedStandardHighlightColor).rgba());
164 break;
165 }
166
167 line.push_back(valueStr);
168 return QVariant(line);
169 }
170 case DebugRegistersListModel::HintColumn:
171 {

Callers 4

paintMethod · 0.45
sizeHintMethod · 0.45
setEditorDataMethod · 0.45
filterAcceptsRowMethod · 0.45

Calls 6

rowMethod · 0.80
sizeMethod · 0.80
nameMethod · 0.45
valueMethod · 0.45
valueStatusMethod · 0.45
hintMethod · 0.45

Tested by

no test coverage detected