src/documentmanager.cpp

changeset 193
b4beff48bb7a
parent 176
cd9d6bf6f649
child 194
be056e87c8ca
equal deleted inserted replaced
192:e6faeffed1d1 193:b4beff48bb7a
368 void DocumentManager::makePolygonCacheForModel(const ModelId modelId) 368 void DocumentManager::makePolygonCacheForModel(const ModelId modelId)
369 { 369 {
370 Model* model = this->getModelById(modelId); 370 Model* model = this->getModelById(modelId);
371 if (model != nullptr) 371 if (model != nullptr)
372 { 372 {
373 this->polygonCaches.emplace( 373 this->polygonCaches[modelId] = {};
374 std::piecewise_construct, 374 connect(model, &Model::dataChanged, this, &DocumentManager::modelModified);
375 std::forward_as_tuple(modelId), 375 connect(model, &Model::rowsInserted, this, &DocumentManager::modelModified);
376 std::forward_as_tuple(model)); 376 connect(model, &Model::rowsRemoved, this, &DocumentManager::modelModified);
377 }
378 }
379
380 void DocumentManager::modelModified()
381 {
382 Model* model = qobject_cast<Model*>(this->sender());
383 for (auto it = this->openModels.begin(); it != this->openModels.end(); ++it) {
384 if (model == it->second.model.get()) {
385 this->polygonCaches[it->second.id].needRecache = true;
386 break;
387 }
377 } 388 }
378 } 389 }
379 390
380 static QString findFile(QString referenceName, const QString& path, const LibraryManager& libraries) 391 static QString findFile(QString referenceName, const QString& path, const LibraryManager& libraries)
381 { 392 {

mercurial