Wed, 25 May 2022 17:47:06 +0300
simplify further
src/documentmanager.cpp | file | annotate | diff | comparison | revisions |
--- a/src/documentmanager.cpp Wed May 25 17:42:02 2022 +0300 +++ b/src/documentmanager.cpp Wed May 25 17:47:06 2022 +0300 @@ -380,11 +380,9 @@ void DocumentManager::modelModified() { Model* model = qobject_cast<Model*>(this->sender()); - for (auto it = this->openModels.begin(); it != this->openModels.end(); ++it) { - if (model == it->second.model.get()) { - this->polygonCaches[it->second.id].needRecache = true; - break; - } + const std::optional<ModelId> modelId = this->findIdForModel(model); + if (modelId.has_value()) { + this->polygonCaches[*modelId].needRecache = true; } }