| 39 | } |
| 40 | |
| 41 | bool ArrayGroupModel::setGroupName(vtkStringToken groupName, bool signalChange) |
| 42 | { |
| 43 | if (groupName == this->GroupName) |
| 44 | { |
| 45 | return false; |
| 46 | } |
| 47 | if (signalChange) |
| 48 | { |
| 49 | Q_EMIT beginResetModel(); |
| 50 | } |
| 51 | // Clear and rebuild CurrentTable, ArrayColumnStart, ColumnToArrayComponent. |
| 52 | this->GroupName = groupName; |
| 53 | this->CurrentTable = this->Data->FindAttributes(this->GroupName); |
| 54 | this->ColumnToArrayComponent.clear(); |
| 55 | this->ArrayColumnStart.clear(); |
| 56 | if (this->CurrentTable) |
| 57 | { |
| 58 | int numArrays = this->CurrentTable->GetNumberOfArrays(); |
| 59 | for (int ii = 0; ii < numArrays; ++ii) |
| 60 | { |
| 61 | auto* array = this->CurrentTable->GetAbstractArray(ii); |
| 62 | this->ArrayColumnStart[array->GetName()] = |
| 63 | static_cast<int>(this->ColumnToArrayComponent.size()); |
| 64 | int numComps = array->GetNumberOfComponents(); |
| 65 | for (int jj = 0; jj < numComps; ++jj) |
| 66 | { |
| 67 | this->ColumnToArrayComponent.emplace_back(array, jj, columnName(array, jj)); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | // Notify Qt the table has completely changed. |
| 72 | if (signalChange) |
| 73 | { |
| 74 | Q_EMIT endResetModel(); |
| 75 | } |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | int ArrayGroupModel::rowCount(const QModelIndex& parent) const |
| 80 | { |
no test coverage detected