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

Method setData

ui/registerswidget.cpp:286–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284
285
286bool DebugRegistersListModel::setData(const QModelIndex& index, const QVariant& value, int role)
287{
288 if ((flags(index) & Qt::ItemIsEditable) != Qt::ItemIsEditable)
289 return false;
290
291 QString valueStr = value.toString();
292 if (valueStr.size() == 0)
293 return false;
294
295 if (index.column() >= columnCount() || (size_t)index.row() >= m_items.size())
296 return false;
297
298 DebugRegisterItem* item = static_cast<DebugRegisterItem*>(index.internalPointer());
299 if (!item)
300 return false;
301
302 uint64_t currentValue = item->value();
303
304 uint64_t newValue = 0;
305 std::string errorString;
306 if (!BinaryView::ParseExpression(
307 m_controller->GetLiveView(), valueStr.toStdString(), newValue, currentValue, errorString))
308 return false;
309
310 if (newValue == currentValue)
311 return false;
312
313 if (!m_controller->SetRegisterValue(item->name(), newValue))
314 return false;
315
316 return true;
317}
318
319
320DebugRegistersItemDelegate::DebugRegistersItemDelegate(QWidget* parent) : QStyledItemDelegate(parent)

Callers

nothing calls this directly

Calls 6

sizeMethod · 0.80
rowMethod · 0.80
valueMethod · 0.45
GetLiveViewMethod · 0.45
SetRegisterValueMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected