From 697541ea2c50ba97fc4b4e31e9e7c4d82be51899 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 28 Sep 2013 08:55:45 +0200 Subject: Fix copy constructor of SmTreeItem Seems the copy constructor of SmTreeItem was botched. After copying a rootItem, some children wouldn't show up. I guess it has something to do with the QHash of the parents. Replace it with an explictit deep copy function where needed. --- smtreeitem.cpp | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'smtreeitem.cpp') diff --git a/smtreeitem.cpp b/smtreeitem.cpp index 4548655..a8e183c 100644 --- a/smtreeitem.cpp +++ b/smtreeitem.cpp @@ -21,32 +21,7 @@ SmTreeItem::SmTreeItem(int rows, SmTreeItem *parent) : mParent(parent){ SmTreeItem::SmTreeItem(const SmTreeItem &other){ mParent = 0; mData = other.mData; - QVector remaining; - QHash parents; - parents.insert(&other, this); - const SmTreeItem *cur = &other; - for(int i = 0; i < cur->childCount(); ++i){ - remaining << cur->child(i); - } - while(cur){ - cur = remaining.last(); - remaining.pop_back(); - for(int i = 0; i < cur->childCount(); ++i){ - remaining << cur->child(i); - } - if(remaining.isEmpty()){ - break; - } - SmTreeItem *newItem = new SmTreeItem(mData.size()); - for(int i = 0; i < cur->columnCount(); ++i){ - newItem->setData(i, cur->data(i)); - } - SmTreeItem *newParent = parents.value(cur->parent()); - newParent->appendChild(newItem); - newItem->setParent(newParent); - parents.insert(cur, newItem); - - } + mForegroundColor = other.mForegroundColor; } SmTreeItem::~SmTreeItem(){ -- cgit v1.2.3-70-g09d2