From 00bc7babe3cd4f5015c0d82a3a86e3aec42578cb Mon Sep 17 00:00:00 2001 From: David Bommes Date: Mon, 5 Oct 2009 13:57:34 +0000 Subject: [PATCH] fixed double datacontrol entry bug git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7318 383ad7c9-94d9-4d36-a494-682f7c89f535 --- TreeModel.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TreeModel.cc b/TreeModel.cc index 87569b0..9f0df63 100644 --- a/TreeModel.cc +++ b/TreeModel.cc @@ -447,6 +447,13 @@ void TreeModel::objectChanged(int _id) { */ void TreeModel::objectAdded(BaseObject* _object){ + // check if item already in model tree + // this function can be called by addEmpty and fileOpened + // both will be called by fileOpened such that the item + // already exists + if( rootItem_->childExists( _object->id() )) + return; + TreeItem* parent = 0; //find the parent if ( _object->parent() == PluginFunctions::objectRoot() ) @@ -454,7 +461,6 @@ void TreeModel::objectAdded(BaseObject* _object){ else parent = rootItem_->childExists( _object->parent()->id() ); - if (parent != 0){ QModelIndex parentIndex = getModelIndex(parent, 0); -- GitLab