| 18 | } |
| 19 | |
| 20 | QVariant DeviceListModel::data(const QModelIndex &index, int role) const |
| 21 | { |
| 22 | if (!index.isValid()) |
| 23 | return QVariant(); |
| 24 | |
| 25 | auto device = devices[index.row()]; |
| 26 | |
| 27 | switch (role) { |
| 28 | case Qt::ItemDataRole::DisplayRole: |
| 29 | return QString::fromStdString(device.description); |
| 30 | case Qt::ItemDataRole::UserRole: |
| 31 | return QVariant::fromValue(device); |
| 32 | default: |
| 33 | return QVariant(); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | bool DeviceListModel::loadRemaining(PresetRuleTableModel* ruleModel) |
| 38 | { |