| 125 | } |
| 126 | |
| 127 | virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const |
| 128 | { |
| 129 | QModelIndex sourceIndex = mapToSource(index); |
| 130 | |
| 131 | if (index.column() == 0 && role == Qt::CheckStateRole) |
| 132 | { |
| 133 | QFileSystemModel *fsm = qobject_cast<QFileSystemModel *>(sourceModel()); |
| 134 | auto blockedPath = relPath(fsm->filePath(sourceIndex)); |
| 135 | auto cover = blocked.cover(blockedPath); |
| 136 | if (!cover.isNull()) |
| 137 | { |
| 138 | return QVariant(Qt::Unchecked); |
| 139 | } |
| 140 | else if (blocked.exists(blockedPath)) |
| 141 | { |
| 142 | return QVariant(Qt::PartiallyChecked); |
| 143 | } |
| 144 | else |
| 145 | { |
| 146 | return QVariant(Qt::Checked); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | return sourceIndex.data(role); |
| 151 | } |
| 152 | |
| 153 | virtual bool setData(const QModelIndex &index, const QVariant &value, |
| 154 | int role = Qt::EditRole) |
no test coverage detected