| 146 | } |
| 147 | |
| 148 | QVariant CFavoriteModel::data(const QModelIndex &index, int role) const |
| 149 | { |
| 150 | //qDebug(log) << "date:" << index; |
| 151 | if (!index.isValid()) |
| 152 | return QVariant(); |
| 153 | if(0 != index.column()) return QVariant(); |
| 154 | tree* ip = static_cast<tree*>(index.internalPointer()); |
| 155 | if(!ip) return QVariant(); |
| 156 | auto item = ip->item; |
| 157 | switch(role) { |
| 158 | case Qt::DecorationRole: |
| 159 | return item.GetIcon(); |
| 160 | case Qt::DisplayRole: |
| 161 | return item.szName; |
| 162 | case Qt::ToolTipRole: |
| 163 | return item.szDescription; |
| 164 | case CFavoriteModel::RoleFile: |
| 165 | return item.szFile; |
| 166 | case RoleNodeType: |
| 167 | return item.type; |
| 168 | case RoleItem: |
| 169 | return QVariant::fromValue(item); |
| 170 | default: |
| 171 | break; |
| 172 | } |
| 173 | |
| 174 | return QVariant(); |
| 175 | } |
| 176 | |
| 177 | bool CFavoriteModel::setData(const QModelIndex &index, const QVariant &value, int role) |
| 178 | { |
no test coverage detected