From: vsr Date: Mon, 24 Jan 2011 16:15:35 +0000 (+0000) Subject: Fix observer problem: order of the objects is not kept if NewObjectToTag() method... X-Git-Tag: V6_3_0a1~83 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cffc4c7ac47f14c140688e92f6df205c29bf6d40;p=modules%2Fgui.git Fix observer problem: order of the objects is not kept if NewObjectToTag() method is used --- 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 ); } /*!