diff view/AlignmentView.cpp @ 1475:84c4ddb38415 by-id

Further layer updates
author Chris Cannam
date Tue, 02 Jul 2019 15:29:17 +0100
parents 9abddbd57667
children c5589d94b731
line wrap: on
line diff
--- a/view/AlignmentView.cpp	Tue Jul 02 14:08:44 2019 +0100
+++ b/view/AlignmentView.cpp	Tue Jul 02 15:29:17 2019 +0100
@@ -147,25 +147,26 @@
         return getDefaultKeyFrames();
     }
 
-    SparseOneDimensionalModel *m = nullptr;
+    ModelId m;
 
     // get the topmost such
     for (int i = 0; i < m_above->getLayerCount(); ++i) {
         if (qobject_cast<TimeInstantLayer *>(m_above->getLayer(i))) {
-            SparseOneDimensionalModel *mm = 
-                qobject_cast<SparseOneDimensionalModel *>
-                (m_above->getLayer(i)->getModel());
-            if (mm) m = mm;
+            ModelId mm = m_above->getLayer(i)->getModel();
+            if (ModelById::isa<SparseOneDimensionalModel>(mm)) {
+                m = mm;
+            }
         }
     }
 
-    if (!m) {
+    auto model = ModelById::getAs<SparseOneDimensionalModel>(m);
+    if (!model) {
         return getDefaultKeyFrames();
     }
 
     vector<sv_frame_t> keyFrames;
 
-    EventVector pp = m->getAllEvents();
+    EventVector pp = model->getAllEvents();
     for (EventVector::const_iterator pi = pp.begin(); pi != pp.end(); ++pi) {
         keyFrames.push_back(pi->getFrame());
     }