| 392 | } |
| 393 | |
| 394 | QVariant ResourceFolderModel::data(const QModelIndex& index, int role) const |
| 395 | { |
| 396 | if (!validateIndex(index)) |
| 397 | return {}; |
| 398 | |
| 399 | int row = index.row(); |
| 400 | int column = index.column(); |
| 401 | |
| 402 | switch (role) { |
| 403 | case Qt::DisplayRole: |
| 404 | switch (column) { |
| 405 | case NAME_COLUMN: |
| 406 | return m_resources[row]->name(); |
| 407 | case DATE_COLUMN: |
| 408 | return m_resources[row]->dateTimeChanged(); |
| 409 | default: |
| 410 | return {}; |
| 411 | } |
| 412 | case Qt::ToolTipRole: |
| 413 | return m_resources[row]->internal_id(); |
| 414 | case Qt::CheckStateRole: |
| 415 | switch (column) { |
| 416 | case ACTIVE_COLUMN: |
| 417 | return m_resources[row]->enabled() ? Qt::Checked : Qt::Unchecked; |
| 418 | default: |
| 419 | return {}; |
| 420 | } |
| 421 | default: |
| 422 | return {}; |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | bool ResourceFolderModel::setData(const QModelIndex& index, const QVariant& value, int role) |
| 427 | { |
nothing calls this directly
no test coverage detected