+ return;
+ }
+ }
+ //Selection happens in Upper label
+ myActiveDocLbl->setReadOnly(false);
+ myActiveDocLbl->setFocus();
+ myActiveDocLbl->selectAll();
+ myActiveDocLbl->grabMouse();
+ myActiveDocLbl->setProperty("OldText", myActiveDocLbl->text());
+}
+
+//***************************************************
+void XGUI_ObjectsBrowser::rebuildDataTree()
+{
+ myDocModel->rebuildDataTree();
+ update();
+}
+
+//***************************************************
+void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects)
+{
+ QList<QModelIndex> theIndexes;
+ QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
+ aSelectModel->clear();
+
+ foreach(ObjectPtr aFeature, theObjects)
+ {
+ QModelIndex aIndex = myDocModel->objectIndex(aFeature);
+ if (aIndex.isValid()) {
+ aSelectModel->select(aIndex, QItemSelectionModel::Select);
+ }
+ }
+}
+
+//***************************************************
+void XGUI_ObjectsBrowser::clearContent()
+{
+ myTreeView->clear();
+}
+
+#ifdef ModuleDataModel
+void XGUI_ObjectsBrowser::setDataModel(ModuleBase_IDocumentDataModel* theModel)
+{
+ myDocModel = theModel;
+ //myDocModel = new XGUI_DataModel(this);
+ myTreeView->setModel(myDocModel);
+ QItemSelectionModel* aSelMod = myTreeView->selectionModel();
+ connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+ this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
+}
+#endif
+
+void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& theSelected,
+ const QItemSelection& theDeselected)
+{
+ emit selectionChanged();
+}
+
+QObjectPtrList XGUI_ObjectsBrowser::selectedObjects(QModelIndexList* theIndexes) const
+{
+ QObjectPtrList aList;
+ QModelIndexList aIndexes = selectedIndexes();
+#ifdef ModuleDataModel
+ ModuleBase_IDocumentDataModel* aModel = dataModel();
+#else
+ XGUI_DataModel* aModel = dataModel();
+#endif
+ QModelIndexList::const_iterator aIt;
+ for (aIt = aIndexes.constBegin(); aIt != aIndexes.constEnd(); ++aIt) {
+ if ((*aIt).column() == 0) {
+ ObjectPtr aObject = aModel->object(*aIt);
+ if (aObject) {
+ aList.append(aObject);
+ if (theIndexes)
+ theIndexes->append(*aIt);
+ }