From cffc4c7ac47f14c140688e92f6df205c29bf6d40 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 24 Jan 2011 16:15:35 +0000 Subject: [PATCH] Fix observer problem: order of the objects is not kept if NewObjectToTag() method is used --- src/SalomeApp/SalomeApp_DataObject.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/SalomeApp/SalomeApp_DataObject.cxx b/src/SalomeApp/SalomeApp_DataObject.cxx index 2e143d567..328f666c6 100644 --- a/src/SalomeApp/SalomeApp_DataObject.cxx +++ b/src/SalomeApp/SalomeApp_DataObject.cxx @@ -573,25 +573,25 @@ QString SalomeApp_DataObject::value( const _PTR(SObject)& obj ) const return val; } -void SalomeApp_DataObject::insertChildAtTag(SalomeApp_DataObject* obj,int tag) +void SalomeApp_DataObject::insertChildAtTag( SalomeApp_DataObject* obj, int tag ) { - int pos=0; - int npos=std::min(tag-1,childCount()); - for (int i=npos;i>0;i--) + int pos = 0; + int npos = qMin( tag-1,childCount() ); + for ( int i = npos; i > 0; i-- ) + { + if ( (dynamic_cast( childObject( i-1 ) ) )->object()->Tag() < tag ) { - if((dynamic_cast(childObject(i-1)))->object()->Tag() < tag) - { - pos=i-1; - break; - } + pos = i; + break; } - insertChildAtPos(obj,pos+1); + } + insertChildAtPos( obj, pos ); } void SalomeApp_DataObject::updateItem() { - if(modified())return; - setModified(true); + if ( modified() ) return; + setModified( true ); } /*! -- 2.39.2