src/model.cpp

changeset 328
3ea38fd469ca
parent 326
65dbfcb859a7
child 329
6d75fa09cc0c
equal deleted inserted replaced
327:2aa15daa0216 328:3ea38fd469ca
272 std::size_t Model::size() const 272 std::size_t Model::size() const
273 { 273 {
274 return this->body.size(); 274 return this->body.size();
275 } 275 }
276 276
277 void save(const Model &model, QIODevice *device) 277 void Model::clear()
278 { 278 {
279 QTextStream out{device}; 279 this->beginResetModel();
280 this->body.clear();
281 this->endResetModel();
282 }
283
284 void save(const Model &model, QTextStream* stream)
285 {
280 for (std::size_t i = 0; i < model.size(); ++i) { 286 for (std::size_t i = 0; i < model.size(); ++i) {
281 out << modelElementToString(model[i]) << "\r\n"; 287 (*stream) << modelElementToString(model[i]) << "\r\n";
282 } 288 }
283 } 289 }
284 290
285 /** 291 /**
286 * @brief Sets the path to the model 292 * @brief Sets the path to the model

mercurial