| 284 | |
| 285 | |
| 286 | bool 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 | |
| 320 | DebugRegistersItemDelegate::DebugRegistersItemDelegate(QWidget* parent) : QStyledItemDelegate(parent) |
nothing calls this directly
no test coverage detected