src/model.cpp

changeset 112
5760cbb32bc0
parent 111
1f42c03fafca
child 133
e39326ee48dc
equal deleted inserted replaced
111:1f42c03fafca 112:5760cbb32bc0
119 } 119 }
120 120
121 void Model::append(ModelObjectPointer&& object) 121 void Model::append(ModelObjectPointer&& object)
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 Q_EMIT beginInsertRows({}, position, position);
125 this->body.push_back(std::move(object)); 125 this->body.push_back(std::move(object));
126 emit endInsertRows(); 126 Q_EMIT endInsertRows();
127 this->needRecache = true; 127 this->needRecache = true;
128 } 128 }
129 129
130 void Model::remove(int position) 130 void Model::remove(int position)
131 { 131 {
132 if (position >= 0 and position < signed_cast(this->body.size())) 132 if (position >= 0 and position < signed_cast(this->body.size()))
133 { 133 {
134 emit beginRemoveRows({}, position, position); 134 Q_EMIT beginRemoveRows({}, position, position);
135 this->body.erase(std::begin(this->body) + position); 135 this->body.erase(std::begin(this->body) + position);
136 emit endRemoveRows(); 136 Q_EMIT endRemoveRows();
137 this->needRecache = true; 137 this->needRecache = true;
138 } 138 }
139 } 139 }
140 140
141 ldraw::Object* Model::objectAt(const QModelIndex& index) 141 ldraw::Object* Model::objectAt(const QModelIndex& index)

mercurial