+void PartSet_DocumentDataModel::onMouseDoubleClick(const QModelIndex& theIndex)
+{
+ if (theIndex.column() != 1)
+ return;
+ if (flags(theIndex) == 0)
+ return;
+ QTreeView* aTreeView = dynamic_cast<QTreeView*>(sender());
+ if ((theIndex.internalId() >= PartsFolder) && (theIndex.internalId() <= PartResult)) {
+ if (myActivePartModel)
+ // It means that the root document is not active
+ return;
+ QModelIndex aNewIndex;
+ if (theIndex.internalId() == HistoryNode)
+ aNewIndex = theIndex;
+ int aOldId = lastHistoryRow();
+ setLastHistoryItem(theIndex);
+ int aStartRow = std::min(aOldId, theIndex.row());
+ int aEndRow = std::max(aOldId, theIndex.row());
+ for (int i = aStartRow; i <= aEndRow; i++) {
+ aTreeView->update(createIndex(i, 0, HistoryNode));
+ aTreeView->update(createIndex(i, 1, HistoryNode));
+ }
+
+ } else {
+ QModelIndex* aIndex = toSourceModelIndex(theIndex);
+ const QAbstractItemModel* aModel = aIndex->model();
+ if (isPartSubModel(aModel)) {
+ PartSet_PartDataModel* aPartModel = (PartSet_PartDataModel*)aModel;
+ QModelIndex aOldItem = aPartModel->lastHistoryItem();
+ aPartModel->setLastHistoryItem(*aIndex);
+ QModelIndex aOldIndex = createIndex(aOldItem.row(), aOldItem.column(), (void*) getModelIndex(aOldItem));
+ int aStartRow = std::min(aOldItem.row(), aIndex->row());
+ int aEndRow = std::max(aOldItem.row(), aIndex->row());
+ for (int i = aStartRow; i <= aEndRow; i++) {
+ QModelIndex aInd1 = aPartModel->index(i, 0);
+ QModelIndex aInd2 = createIndex(i, 0, (void*) getModelIndex(aInd1));
+ aTreeView->update(aInd2);
+ aInd1 = aPartModel->index(i, 1);
+ aInd2 = createIndex(i, 1, (void*) getModelIndex(aInd1));
+ aTreeView->update(aInd2);
+ }
+ }
+ }
+}
+
+
+PartSet_PartModel* PartSet_DocumentDataModel::findPartModel(FeaturePtr thePart) const
+{
+ foreach (PartSet_PartModel* aModel, myPartModels) {
+ if (aModel->part() == thePart)
+ return aModel;
+ }
+ return 0;
+}
+
+PartSet_PartModel* PartSet_DocumentDataModel::findPartModel(int thePosition) const
+{
+ foreach (PartSet_PartModel* aModel, myPartModels) {
+ if (aModel->position() == thePosition)
+ return aModel;
+ }
+ return 0;
+}
\ No newline at end of file