Salome HOME
Merge remote branch 'origin/V7_dev' into V8_0_0_BR
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_ReduceStudyDlg.cxx
index 82c380ea7b22feef0f4bbb09c853191d30eb3c33..6784a91d6aaa2b471287d870374b46689ce4705f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2014-2015  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,7 @@
 
 #include <SalomeApp_Application.h>
 #include <SalomeApp_Study.h>
-#include <SALOME_ListIteratorOfListIO.hxx>
+#include <SALOME_ListIO.hxx>
 
 // Qt includes
 #include <QGridLayout>
@@ -222,9 +222,15 @@ void GEOMToolsGUI_ReduceStudyDlg::createTreeWidget( QTreeWidget* theTreeWidget )
   QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames );
   theTreeWidget->setHeaderItem ( headerItem );
   theTreeWidget->header()->moveSection( 1, 0 );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   theTreeWidget->header()->setClickable( true );
   theTreeWidget->header()->setMovable( false );
   theTreeWidget->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+#else
+  theTreeWidget->header()->setSectionsClickable( true );
+  theTreeWidget->header()->setSectionsMovable( false );
+  theTreeWidget->header()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
+#endif
   theTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
 }
 
@@ -282,7 +288,10 @@ GEOMToolsGUI_TreeWidgetItem* GEOMToolsGUI_ReduceStudyDlg::addSubObject( QTreeWid
 {
   GEOMToolsGUI_TreeWidgetItem* item;
   if( !theObject->IsMainShape() ) {
-    GEOMToolsGUI_TreeWidgetItem* parentItem = addSubObject( theWidget, theObjects, theObject->GetMainShape() );
+    GEOM::GEOM_Object_var aMainShape = theObject->GetMainShape();
+    if ( CORBA::is_nil( aMainShape ) )
+      return NULL;
+    GEOMToolsGUI_TreeWidgetItem* parentItem = addSubObject( theWidget, theObjects, aMainShape );
     item = findObjectInTree( theWidget, theObject );
     if( !item )
       item = new GEOMToolsGUI_TreeWidgetItem( parentItem, QStringList() << theObject->GetName(), theObject->GetStudyEntry() );
@@ -446,7 +455,7 @@ void GEOMToolsGUI_ReduceStudyDlg::removeObject( std::string& theStudyEntry )
   _PTR(SObject) obj ( myStudy->FindObjectID( theStudyEntry.c_str() ) );
   if ( obj ) {
     // remove visual properties of the object
-    appStudy->removeObjectFromAll(obj->GetID().c_str());
+    appStudy->removeObjectProperties(obj->GetID().c_str());
     // remove references to this object
     appStudy->deleteReferencesTo( obj );
     // remove objects from study