| 72 | } |
| 73 | |
| 74 | QVariant RamWatchModel::data(const QModelIndex &index, int role) const |
| 75 | { |
| 76 | const std::unique_ptr<RamWatchDetailed> &watch = ramwatches.at(index.row()); |
| 77 | if (role == Qt::DisplayRole || role == Qt::EditRole) { |
| 78 | switch(index.column()) { |
| 79 | case 0: |
| 80 | if (watch->is_pointer) |
| 81 | return QString("P->%1").arg(watch->address, 0, 16); |
| 82 | else |
| 83 | return QString("%1").arg(watch->address, 0, 16); |
| 84 | case 1: |
| 85 | return QString(watch->value_str()); |
| 86 | case 2: |
| 87 | return QString(watch->label.c_str()); |
| 88 | default: |
| 89 | return QString(); |
| 90 | } |
| 91 | } |
| 92 | if (role == Qt::ForegroundRole) { |
| 93 | if (index.column() == 1) { |
| 94 | if (watch->is_frozen) { |
| 95 | return QBrush(QColorConstants::Red); |
| 96 | } |
| 97 | } |
| 98 | return QGuiApplication::palette().text(); |
| 99 | } |
| 100 | return QVariant(); |
| 101 | } |
| 102 | |
| 103 | bool RamWatchModel::setData(const QModelIndex &index, const QVariant &value, int role) |
| 104 | { |