| 78 | } |
| 79 | |
| 80 | Zpace *ZpacesModel::insertZpace(const int &index) |
| 81 | { |
| 82 | if(!indexIsValid(index)) |
| 83 | return nullptr; |
| 84 | |
| 85 | // if(index > m_zpacesList.count() || index < 0) //we want to be able to insert at count+1 |
| 86 | // { |
| 87 | // return nullptr; |
| 88 | // } |
| 89 | |
| 90 | auto newZpace = createZpace(); |
| 91 | this->beginInsertRows(QModelIndex(), index, index); |
| 92 | m_zpacesList.insert(index, newZpace); |
| 93 | this->endInsertRows(); |
| 94 | emit this->countChanged(); |
| 95 | emit this->zpaceAdded(index); |
| 96 | |
| 97 | return newZpace; |
| 98 | } |
| 99 | |
| 100 | void ZpacesModel::removeZpace(const int &index) |
| 101 | { |