| 80 | } |
| 81 | |
| 82 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
| 83 | { |
| 84 | if(index.isValid()) |
| 85 | { |
| 86 | const rdcarray<ResourceDescription> &resources = m_Ctx.GetResources(); |
| 87 | |
| 88 | if(index.row() < resources.count()) |
| 89 | { |
| 90 | const ResourceDescription &desc = resources[index.row()]; |
| 91 | |
| 92 | if(role == Qt::DisplayRole) |
| 93 | return m_Ctx.GetResourceName(desc.resourceId); |
| 94 | |
| 95 | if(role == ResourceIdRole) |
| 96 | return QVariant::fromValue(desc.resourceId); |
| 97 | |
| 98 | if(role == FilterRole) |
| 99 | return ToQStr(desc.type) + lit(" ") + m_Ctx.GetResourceName(desc.resourceId); |
| 100 | |
| 101 | if(role == LastAccessSortRole) |
| 102 | return m_LastUse[desc.resourceId]; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | return QVariant(); |
| 107 | } |
| 108 | |
| 109 | private: |
| 110 | ICaptureContext &m_Ctx; |
no test coverage detected