| 105 | } |
| 106 | |
| 107 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const |
| 108 | { |
| 109 | QModelIndex sourceIndex = mapToSource(index); |
| 110 | |
| 111 | if (index.column() == 0 && role == Qt::CheckStateRole) |
| 112 | { |
| 113 | QFileSystemModel *fsm = qobject_cast<QFileSystemModel *>(sourceModel()); |
| 114 | auto blockedPath = relPath(fsm->filePath(sourceIndex)); |
| 115 | auto cover = blocked.cover(blockedPath); |
| 116 | if (!cover.isNull()) |
| 117 | { |
| 118 | return QVariant(Qt::Unchecked); |
| 119 | } |
| 120 | else if (blocked.exists(blockedPath)) |
| 121 | { |
| 122 | return QVariant(Qt::PartiallyChecked); |
| 123 | } |
| 124 | else |
| 125 | { |
| 126 | return QVariant(Qt::Checked); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return sourceIndex.data(role); |
| 131 | } |
| 132 | |
| 133 | virtual bool setData(const QModelIndex &index, const QVariant &value, |
| 134 | int role = Qt::EditRole) |
no test coverage detected