+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
#include "OB_Browser.h"
#include "OB_Filter.h"
return;
myRootDecorated = decor;
- updateTree();
+ updateTree( 0, false );
}
int OB_Browser::autoOpenLevel() const
myView->setAppropriate( myColumnIds[id], on );
}
-void OB_Browser::updateTree( SUIT_DataObject* obj )
+void OB_Browser::updateTree( SUIT_DataObject* obj, const bool autoOpen )
{
if ( !obj && !(obj = getRootObject()) )
return;
restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
- autoOpenBranches();
+ if( autoOpen )
+ autoOpenBranches();
setModified();
if ( openObjs.contains( obj ) )
{
- if ( openObjs[obj] )
+ bool parentOpen = true;
+ if( item && item->parent() )
+ parentOpen = item->parent()->isOpen();
+
+ if ( openObjs[obj] && parentOpen )
lv->setOpen( item, true );
}
else if ( !key.isNull() && openKeys.contains( key ) )
- lv->setOpen( item, true );
+ {
+ bool parentOpen = true;
+ if( item && item->parent() )
+ parentOpen = item->parent()->isOpen();
+
+ if( parentOpen )
+ lv->setOpen( item, true );
+ }
if ( !curItem && ( curObj == obj || ( !curKey.isNull() && curKey == key )) )
curItem = item;
void OB_Browser::keyPressEvent( QKeyEvent* e )
{
if ( e->key() == Qt::Key_F5 )
- updateTree();
+ updateTree( 0, false );
QFrame::keyPressEvent( e );
}
// Otherwise, "delete item" line will destroy all item's children,
// and <myItems> will contain invalid pointers (see ~QListViewItem() description in Qt docs)
DataObjectList childList;
- obj->children( childList );
+ obj->children( childList, true );
for ( DataObjectListIterator it( childList ); it.current(); ++it )
- removeObject( it.current(), false );
+ {
+ it.current()->disconnect( this, SLOT( onDestroyed( SUIT_DataObject* ) ) );
+ myItems.remove( it.current() );
+ }
QListViewItem* item = listViewItem( obj );
if ( isAutoUpdate() )
{
SUIT_DataObject* pObj = item && item->parent() ? dataObject( item->parent() ) : 0;
- updateTree( pObj );
+ updateTree( pObj, false );
}
else
delete item;
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
#ifndef OB_BROWSER_H
#define OB_BROWSER_H
bool isAutoDeleteObjects() const;
virtual void setAutoDeleteObjects( const bool );
- virtual void updateTree( SUIT_DataObject* = 0 );
+ virtual void updateTree( SUIT_DataObject* = 0, const bool autoOpen = true );
virtual void replaceTree( SUIT_DataObject*, SUIT_DataObject* );
bool isShowToolTips();