ModuleBase_ITreeNode* aNode = (ModuleBase_ITreeNode*)theIndex.internalPointer();
return aNode->document();
}
+
+
+//******************************************************
+bool XGUI_DataModel::hasNode(ModuleBase_ITreeNode* theNode) const
+{
+ return myRoot->hasSubNode(theNode);
+}
/// \param theIndex an index to check
bool hasIndex(const QModelIndex& theIndex) const;
+ /// Returns true if the given node is a parto of the data tree
+ /// \param theNode a node to check
+ bool hasNode(ModuleBase_ITreeNode* theNode) const;
+
+ /// Returns document of the given index
+ /// \param theIndex an index to check
DocumentPtr document(const QModelIndex& theIndex) const;
+ /// Returns index for the node and column
+ /// \param theNode a node
+ /// \param thCol a column
QModelIndex getIndex(ModuleBase_ITreeNode* theNode, int thCol) const;
signals:
+ /// Signal send before tree rebuild
void beforeTreeRebuild();
-
/// Signal about tree had been rebuilt
void treeRebuilt();
XGUI_DataModel* aModel = myTreeView->dataModel();
QModelIndex aIndex;
foreach(ModuleBase_ITreeNode* aNode, myExpandedItems) {
- aIndex = aModel->getIndex(aNode, 0);
- if (aIndex.isValid() && (myTreeView->dataModel()->hasIndex(aIndex)) )
- myTreeView->setExpanded(aIndex, true);
+ if (aModel->hasNode(aNode)) {
+ aIndex = aModel->getIndex(aNode, 0);
+ if (aIndex.isValid() && (myTreeView->dataModel()->hasIndex(aIndex)))
+ myTreeView->setExpanded(aIndex, true);
+ }
}
+ myExpandedItems.clear();
}
std::list<bool> XGUI_ObjectsBrowser::getStateForDoc(DocumentPtr theDoc) const