+ ObjectPtr aObject;
+ QModelIndexList aUnselect;
+ QObjectPtrList aToSelect = theObjects;
+ QHash<qint64, ObjectPtr> aNotChanged;
+ foreach(QModelIndex aIdx, aIndexes) {
+ aObject = myDocModel->object(aIdx);
+ if (aObject.get()) {
+ if (aToSelect.contains(aObject)) {
+ aNotChanged.insert((qint64)aObject.get(), aObject);
+ } else {
+ aUnselect.append(aIdx);
+ }
+ }
+ else {
+ aUnselect.append(aIdx);
+ }
+ }
+
+ foreach(ObjectPtr aObj, aNotChanged)
+ aToSelect.removeAll(aObj);
+
+ bool aIsBlock = aSelectModel->blockSignals(true);
+ foreach(QModelIndex aIdx, aUnselect) {
+ aSelectModel->select(aIdx, QItemSelectionModel::Deselect);
+ myTreeView->update(aIdx);
+ }
+
+ QModelIndex aIndex0, aIndex1, aIndex2, aCurrent;
+ foreach(ObjectPtr aFeature, aToSelect) {
+ aIndex1 = myDocModel->objectIndex(aFeature, 1);
+ if (aIndex1.isValid()) {
+ if (!aCurrent.isValid())
+ aCurrent = aIndex1;
+ aIndex0 = myDocModel->objectIndex(aFeature, 0);
+ aIndex2 = myDocModel->objectIndex(aFeature, 2);
+ aSelectModel->select(aIndex1, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ myTreeView->update(aIndex0);
+ myTreeView->update(aIndex1);
+ myTreeView->update(aIndex2);
+ }
+ }
+ aSelectModel->setCurrentIndex(aCurrent, QItemSelectionModel::NoUpdate);
+ aSelectModel->blockSignals(aIsBlock);
+}
+
+//***************************************************
+void XGUI_ObjectsBrowser::ensureVisible(const ObjectPtr theObject)
+{
+ QModelIndex aIndex = myDocModel->objectIndex(theObject);
+ if (aIndex.isValid()) {
+ QModelIndex aParent = aIndex.parent();
+ while (aParent.isValid()) {
+ myTreeView->expand(aParent);
+ aParent = aParent.parent();