122 { |
122 { |
123 const int position = static_cast<int>(this->body.size()); |
123 const int position = static_cast<int>(this->body.size()); |
124 emit beginInsertRows({}, position, position); |
124 emit beginInsertRows({}, position, position); |
125 this->body.push_back(std::move(object)); |
125 this->body.push_back(std::move(object)); |
126 emit endInsertRows(); |
126 emit endInsertRows(); |
|
127 this->needRecache = true; |
127 } |
128 } |
128 |
129 |
129 void Model::remove(int position) |
130 void Model::remove(int position) |
130 { |
131 { |
131 if (position >= 0 and position < signed_cast(this->body.size())) |
132 if (position >= 0 and position < signed_cast(this->body.size())) |
132 { |
133 { |
133 emit beginRemoveRows({}, position, position); |
134 emit beginRemoveRows({}, position, position); |
134 this->body.erase(std::begin(this->body) + position); |
135 this->body.erase(std::begin(this->body) + position); |
135 emit endRemoveRows(); |
136 emit endRemoveRows(); |
|
137 this->needRecache = true; |
136 } |
138 } |
137 } |
139 } |
138 |
140 |
139 ldraw::Object* Model::objectAt(const QModelIndex& index) |
141 ldraw::Object* Model::objectAt(const QModelIndex& index) |
140 { |
142 { |