src/ldobjectiterator.h

changeset 1073
a0a0d581309b
parent 1072
9ce9496427f2
child 1145
02264bf0108d
--- a/src/ldobjectiterator.h	Sat Jan 28 17:47:06 2017 +0200
+++ b/src/ldobjectiterator.h	Sun Jan 29 15:05:14 2017 +0200
@@ -24,14 +24,14 @@
 class LDObjectIterator
 {
 public:
-	LDObjectIterator (LDDocument* doc) :
-		m_list (doc->objects()),
+	LDObjectIterator (Model* model) :
+	    m_list (model->objects()),
 		m_i (-1)
 	{
 		seekTillValid();
 	}
 
-	LDObjectIterator (const LDObjectList& objs) :
+	LDObjectIterator (const QVector<LDObject*>& objs) :
 		m_list (objs),
 		m_i (-1)
 	{
@@ -111,7 +111,7 @@
 	}
 
 private:
-	const LDObjectList& m_list;
+	const QVector<LDObject*>& m_list;
 	int m_i;
 };
 
@@ -120,8 +120,12 @@
 {
 	QVector<T*> result;
 
-	for (LDObjectIterator<T> it (stuff); it.isValid(); ++it)
-		result << it;
+	for (LDObject* object : stuff)
+	{
+		T* casted = dynamic_cast<T*>(object);
+		if (casted != nullptr)
+			result << casted;
+	}
 
 	return result;
 }

mercurial