-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
headerItem->setIcon( 2, QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) ) );
myTreeWidget->setHeaderItem ( headerItem );
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- myTreeWidget->header()->setClickable( true );
-#else
myTreeWidget->header()->setSectionsClickable( true );
-#endif
myTreeWidget->header()->setSortIndicatorShown( true );
myTreeWidget->header()->moveSection( 2, 0 );
myTreeWidget->setSortingEnabled( true );
if ( appStudy ) {
_PTR(Study) aStudy = appStudy->studyDS();
if ( aStudy ) {
- GEOM_Displayer displayer ( appStudy );
- QTreeWidgetItemIterator it( myTreeWidget );
- while ( *it ) {
- QString entry = myEntryToItem.key( *it );
- _PTR(SObject) SO ( aStudy->FindObjectID( qPrintable( entry ) ) );
- if ( SO ) {
- GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) );
- if ( CORBA::is_nil( aGeomObject ) ) continue;
- if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) {
- Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" );
- displayer.Erase( io );
- }
- }
- ++it;
- }
- displayer.UpdateViewer();
+ GEOM_Displayer displayer;
+ QTreeWidgetItemIterator it( myTreeWidget );
+ while ( *it ) {
+ QString entry = myEntryToItem.key( *it );
+ _PTR(SObject) SO ( aStudy->FindObjectID( qUtf8Printable( entry ) ) );
+ if ( SO ) {
+ GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) );
+ if ( CORBA::is_nil( aGeomObject ) ) continue;
+ if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) {
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" );
+ displayer.Erase( io );
+ }
+ }
+ ++it;
+ }
+ displayer.UpdateViewer();
}
}
}
if(!myGeomRoot)
return;
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
- if(!appStudy )
- return;
-
- _PTR(Study) aStudy = appStudy->studyDS();
- if(!aStudy)
- return;
-
- buildTree(aStudy, myGeomRoot);
+ buildTree(myGeomRoot);
myTreeWidget->resizeColumnToContents(0);
myTreeWidget->resizeColumnToContents(1);
// function : findParentItem()
// purpose :
//=================================================================================
-QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(_PTR(Study) theStudy, SalomeApp_DataObject* theObject, BufferedList& theList ) {
+QTreeWidgetItem* GEOMToolsGUI_PublishDlg::findParentItem(SalomeApp_DataObject* theObject, BufferedList& theList ) {
QTreeWidgetItem* aResult = NULL;
SalomeApp_DataObject* aParrent = dynamic_cast<SalomeApp_DataObject*>(theObject->parent());
if( !(aResult = myEntryToItem.value(targetEntry)) ) {
if( aParrent != myGeomRoot ) {
QString aName;
- _PTR(SObject) aSO ( theStudy->FindObjectID(qPrintable(aParrent->entry())));
+ _PTR(SObject) aSO ( SalomeApp_Application::getStudy()->FindObjectID(qUtf8Printable(aParrent->entry())));
_PTR(GenericAttribute) anAttr;
if ( aSO->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) anAttrName (anAttr);
aName = anAttrName->Value().c_str();
}
theList.push_front(qMakePair(targetEntry, aName));
- aResult = findParentItem(theStudy,aParrent,theList);
+ aResult = findParentItem(aParrent,theList);
} else {
//Publish List
for(int i = 0; i < theList.size(); i++ ) {
// function : buildTree()
// purpose :
//=================================================================================
-void GEOMToolsGUI_PublishDlg::buildTree(_PTR(Study) theStudy, SalomeApp_DataObject* theItem) {
+void GEOMToolsGUI_PublishDlg::buildTree(SalomeApp_DataObject* theItem) {
if(!theItem || theItem->isReference())
return;
//If object hasn't "AttributeDrawable" => it visible
bool isDrawable = true;
- _PTR(SObject) SO ( theStudy->FindObjectID(qPrintable(theItem->entry())));
+ _PTR(SObject) SO ( SalomeApp_Application::getStudy()->FindObjectID(qUtf8Printable(theItem->entry())));
_PTR(GenericAttribute) anAttr;
if ( SO && SO->FindAttribute(anAttr, "AttributeDrawable") ) {
_PTR(AttributeDrawable) aDrw (anAttr);
aName = aAttrName->Value().c_str();
}
BufferedList aList;
- QTreeWidgetItem* parentItem = findParentItem(theStudy, theItem, aList);
+ QTreeWidgetItem* parentItem = findParentItem(theItem, aList);
createItem(parentItem,qMakePair(theItem->entry(),aName),true);
}
}
DataObjectList listObj = theItem->children( false );
DataObjectList::iterator itr = listObj.begin();
while( itr != listObj.end()) {
- buildTree(theStudy, dynamic_cast<SalomeApp_DataObject*>(*itr));
+ buildTree(dynamic_cast<SalomeApp_DataObject*>(*itr));
itr++;
}
}
QTreeWidgetItem* item = toProcess[i];
if(item) {
QString entry = myEntryToItem.key(item);
- _PTR(SObject) SO ( aStudy->FindObjectID(qPrintable(entry)) );
+ _PTR(SObject) SO ( aStudy->FindObjectID(qUtf8Printable(entry)) );
if(!SO) continue;
_PTR(AttributeDrawable) aDrw = aBuilder->FindOrCreateAttribute( SO, "AttributeDrawable" );
aDrw->SetDrawable( true );
_PTR(Study) aStudy = appStudy->studyDS();
if ( !aStudy ) return;
QString entry = myEntryToItem.key( theItem );
- _PTR(SObject) SO ( aStudy->FindObjectID( qPrintable( entry ) ) );
+ _PTR(SObject) SO ( aStudy->FindObjectID( qUtf8Printable( entry ) ) );
if ( !SO ) return;
GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( SO ) );
if ( CORBA::is_nil( aGeomObject ) ) return;
- GEOM_Displayer displayer ( appStudy );
+ GEOM_Displayer displayer;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( aGeomObject->GetStudyEntry(), "GEOM", "" );
if ( displayer.IsDisplayed( aGeomObject->GetStudyEntry() ) ) {