diff --git a/app/project/item/item.cpp b/app/project/item/item.cpp index d694bc1e4..c8aab77f5 100644 --- a/app/project/item/item.cpp +++ b/app/project/item/item.cpp @@ -76,19 +76,13 @@ const QList &Item::children() const return children_; } -ItemPtr Item::shared_ptr_from_raw(Item *item, bool traverse) +ItemPtr Item::get_shared_ptr() const { - for (int i=0;i siblings = parent()->children(); - if (c.get() == item) { - return c; - } else if (traverse && c->CanHaveChildren()) { - ItemPtr grandchild = shared_ptr_from_raw(item); - - if (grandchild) { - return grandchild; - } + foreach (ItemPtr s, siblings) { + if (s.get() == this) { + return s; } } diff --git a/app/project/item/item.h b/app/project/item/item.h index 42cb83bf7..563e9543c 100644 --- a/app/project/item/item.h +++ b/app/project/item/item.h @@ -77,7 +77,7 @@ public: Item* child(int i) const; const QList& children() const; - ItemPtr shared_ptr_from_raw(Item* item, bool traverse = false); + ItemPtr get_shared_ptr() const; const QString& name() const; void set_name(const QString& n);