X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ObjectsBrowser.cpp;h=27b92756283b4e6304239e698a03adb627b4ba26;hb=f8d51abf2ab6024a974d42c139f7650ccf0ef774;hp=258a59f8021fe2b6663f57dbac02b351f4151dad;hpb=ea1f85e839a4208cc3ed0789d924044cccc53aa0;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp index 258a59f80..27b927562 100644 --- a/src/XGUI/XGUI_ObjectsBrowser.cpp +++ b/src/XGUI/XGUI_ObjectsBrowser.cpp @@ -1,5 +1,6 @@ #include "XGUI_ObjectsBrowser.h" #include "XGUI_DocumentDataModel.h" +#include "XGUI_Tools.h" #include #include @@ -85,7 +86,7 @@ void XGUI_DataTree::commitData(QWidget* theEditor) FeaturePtr aFeature = mySelectedData.first(); PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); aMgr->rootDocument()->startOperation(); - if (aFeature->data()) + if (!XGUI_Tools::isModelObject(aFeature)) aFeature->data()->setName(qPrintable(aRes)); else boost::dynamic_pointer_cast(aFeature)->setName(qPrintable(aRes)); @@ -145,7 +146,7 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent) aLabelWgt->setFrameShape(myTreeView->frameShape()); aLabelWgt->setFrameShadow(myTreeView->frameShadow()); - connect(myTreeView, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); + connect(myTreeView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged())); connect(myTreeView, SIGNAL(activePartChanged(FeaturePtr)), this, SLOT(onActivePartChanged(FeaturePtr))); connect(myTreeView, SIGNAL(activePartChanged(FeaturePtr)), this, SIGNAL(activePartChanged(FeaturePtr))); @@ -314,4 +315,33 @@ void XGUI_ObjectsBrowser::onEditItem() myActiveDocLbl->setProperty("OldText", myActiveDocLbl->text()); } } -} \ No newline at end of file +} + +//*************************************************** +void XGUI_ObjectsBrowser::onSelectionChanged() +{ + myFeaturesList = myTreeView->selectedFeatures(); + emit selectionChanged(); +} + +//*************************************************** +void XGUI_ObjectsBrowser::rebuildDataTree() +{ + myDocModel->rebuildDataTree(); + update(); +} + +//*************************************************** +void XGUI_ObjectsBrowser::setFeaturesSelected(const QFeatureList& theFeatures) +{ + QList theIndexes; + QItemSelectionModel* aSelectModel = myTreeView->selectionModel(); + aSelectModel->clear(); + + foreach(FeaturePtr aFeature, theFeatures) { + QModelIndex aIndex = myDocModel->featureIndex(aFeature); + if (aIndex.isValid()) { + aSelectModel->select(aIndex, QItemSelectionModel::Select); + } + } +}