| 52 | } |
| 53 | |
| 54 | QVariant ModelContentProxyModel::data(const QModelIndex &proxyIndex, int role) const |
| 55 | { |
| 56 | // we override this below, so convey enabled state via a custom role |
| 57 | // since disabled is less common then enabled, only transfer disabled states |
| 58 | if (role == DisabledRole) { |
| 59 | if (QIdentityProxyModel::flags(proxyIndex) & Qt::ItemIsEnabled) |
| 60 | return QVariant(); |
| 61 | return true; |
| 62 | } |
| 63 | |
| 64 | if (role == SelectedRole) { |
| 65 | if (m_selectionModel && m_selectionModel->isSelected(mapToSource(proxyIndex))) |
| 66 | return true; |
| 67 | return QVariant(); |
| 68 | } |
| 69 | |
| 70 | // we set the EmptyNameRole to signal this index is unnamed to the delegate |
| 71 | if (role == IsDisplayStringEmptyRole) { |
| 72 | return QIdentityProxyModel::data(proxyIndex, Qt::DisplayRole).toString().isNull(); |
| 73 | } |
| 74 | |
| 75 | return QIdentityProxyModel::data(proxyIndex, role); |
| 76 | } |
| 77 | |
| 78 | Qt::ItemFlags ModelContentProxyModel::flags(const QModelIndex &index) const |
| 79 | { |
no test coverage detected