#include "XGUI_ObjectsBrowser.h"
#include "XGUI_DocumentDataModel.h"
+#include "XGUI_Tools.h"
#include <ModelAPI_Data.h>
#include <ModelAPI_PluginManager.h>
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<ModelAPI_Object>(aFeature)->setName(qPrintable(aRes));
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)));
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<QModelIndex> theIndexes;
+ QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
+ aSelectModel->clear();
+
+ foreach(FeaturePtr aFeature, theFeatures) {
+ QModelIndex aIndex = myDocModel->featureIndex(aFeature);
+ if (aIndex.isValid()) {
+ aSelectModel->select(aIndex, QItemSelectionModel::Select);
+ }
+ }
+}