diff layer/Layer.cpp @ 1489:b402121d8f5f

Add direct method to get source model
author Chris Cannam
date Fri, 02 Aug 2019 16:42:32 +0100
parents e540aa5d89cd
children 4f8c72adbf43
line wrap: on
line diff
--- a/layer/Layer.cpp	Fri Jul 19 16:10:19 2019 +0100
+++ b/layer/Layer.cpp	Fri Aug 02 16:42:32 2019 +0100
@@ -64,6 +64,18 @@
             this, SIGNAL(modelAlignmentCompletionChanged(ModelId)));
 }
 
+ModelId
+Layer::getSourceModel() const
+{
+    ModelId sourceId;
+    auto model = ModelById::get(getModel());
+    while (model && !model->getSourceModel().isNone()) {
+        sourceId = model->getSourceModel();
+        model = ModelById::get(sourceId);
+    }
+    return sourceId;
+}
+
 QString
 Layer::getPropertyContainerIconName() const
 {