| 93 | } |
| 94 | |
| 95 | int AggregateModel::rowCount(const QModelIndex &parent) const |
| 96 | { |
| 97 | Q_D(const AggregateModel); |
| 98 | |
| 99 | if (!parent.isValid()) |
| 100 | { |
| 101 | //toplevel items represent aggregated models |
| 102 | return d->modelList.count(); |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | //Qt model guideline - only 1st column has children |
| 107 | if (parent.column() != 0) |
| 108 | return 0; |
| 109 | |
| 110 | //find out if the parent is an aggregator |
| 111 | if (parent.internalPointer() == d->internal) |
| 112 | { |
| 113 | //return the number of toplevel rows in the source model |
| 114 | return d->modelList[parent.row()]->rowCount(QModelIndex()); |
| 115 | } |
| 116 | else |
| 117 | { |
| 118 | //we have a standard item in the source model - just map it into our model |
| 119 | auto *item = static_cast<QStandardItem*>(parent.internalPointer()); |
| 120 | return item->rowCount(); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | QVariant AggregateModel::data(const QModelIndex &index, int role) const |
| 126 | { |
nothing calls this directly
no test coverage detected