| 33 | } |
| 34 | |
| 35 | void ModelContentProxyModel::setSelectionModel(QItemSelectionModel *selectionModel) |
| 36 | { |
| 37 | Q_ASSERT(!selectionModel || selectionModel->model() == sourceModel()); |
| 38 | if (m_selectionModel == selectionModel) |
| 39 | return; |
| 40 | |
| 41 | if (m_selectionModel) { |
| 42 | disconnect(m_selectionModel.data(), &QItemSelectionModel::selectionChanged, this, &ModelContentProxyModel::selectionChanged); |
| 43 | emitDataChangedForSelection(m_selectionModel->selection()); |
| 44 | } |
| 45 | |
| 46 | m_selectionModel = selectionModel; |
| 47 | |
| 48 | if (m_selectionModel) { |
| 49 | connect(m_selectionModel.data(), &QItemSelectionModel::selectionChanged, this, &ModelContentProxyModel::selectionChanged); |
| 50 | emitDataChangedForSelection(m_selectionModel->selection()); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | QVariant ModelContentProxyModel::data(const QModelIndex &proxyIndex, int role) const |
| 55 | { |