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

Method data

ui/stackwidget.cpp:105–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103
104
105QVariant DebugStackListModel::data(const QModelIndex& index, int role) const
106{
107 if (index.column() >= columnCount() || (size_t)index.row() >= m_items.size())
108 return QVariant();
109
110 DebugStackItem* item = static_cast<DebugStackItem*>(index.internalPointer());
111 if (!item)
112 return QVariant();
113
114
115 if ((role != Qt::DisplayRole) && (role != Qt::SizeHintRole))
116 return QVariant();
117
118 switch (index.column())
119 {
120 case DebugStackListModel::OffsetColumn:
121 {
122 ptrdiff_t value = item->offset();
123 QString valueStr;
124 if (value < 0)
125 valueStr = QString::asprintf("-%" PRIx64, (uint64_t)-value);
126 else
127 valueStr = QString::asprintf("%" PRIx64, (uint64_t)value);
128
129 if (role == Qt::SizeHintRole)
130 return QVariant((qulonglong)valueStr.size());
131
132 QList<QVariant> line;
133 line.push_back(getThemeColor(WhiteStandardHighlightColor).rgba());
134 line.push_back(valueStr);
135 return QVariant(line);
136 }
137 case DebugStackListModel::AddressColumn:
138 {
139 uint64_t value = item->address();
140 QString valueStr = QString::asprintf("%" PRIx64, value);
141 if (role == Qt::SizeHintRole)
142 return QVariant((qulonglong)valueStr.size());
143
144 QList<QVariant> line;
145 line.push_back(getThemeColor(WhiteStandardHighlightColor).rgba());
146 line.push_back(valueStr);
147 return QVariant(line);
148 }
149 case DebugStackListModel::ValueColumn:
150 {
151 uint64_t value = item->value();
152 QString valueStr = QString::asprintf("%" PRIx64, value);
153 if (role == Qt::SizeHintRole)
154 return QVariant((qulonglong)valueStr.size());
155
156 QList<QVariant> line;
157 switch (item->valueStatus())
158 {
159 case DebugStackValueNormal:
160 line.push_back(getThemeColor(WhiteStandardHighlightColor).rgba());
161 break;
162 case DebugStackValueChanged:

Callers 6

printFunction · 0.45
paintMethod · 0.45
sizeHintMethod · 0.45
setEditorDataMethod · 0.45

Calls 7

rowMethod · 0.80
sizeMethod · 0.80
offsetMethod · 0.80
addressMethod · 0.45
valueMethod · 0.45
valueStatusMethod · 0.45
hintMethod · 0.45

Tested by

no test coverage detected