if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
int aStart = myPartModels.size();
removeSubModel(myPartModels.size() - 1);
- removeRow(aStart - 1, partFolderNode());
+ removeRow(aStart, partFolderNode());
} else { // Update top groups (other except parts
QModelIndex aIndex = myModel->findGroup(aUpdMsg->group());
int aStart = myModel->rowCount(aIndex);
aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
- removeRow(aStart - 1, aIndex);
+ removeRow(aStart, aIndex);
}
} else {
XGUI_PartModel* aPartModel = 0;
QModelIndex aIndex = aPartModel->findGroup(aUpdMsg->group());
int aStart = aPartModel->rowCount(aIndex);
aIndex = createIndex(aIndex.row(), aIndex.column(), (void*)getModelIndex(aIndex));
- removeRow(aStart - 1, aIndex);
+ removeRow(aStart, aIndex);
}
}
// if this is root node (Part item index)
if (!aIndex->parent().isValid()) {
if (myActivePart) myActivePart->setItemsColor(PASSIVE_COLOR);
- myActivePart = (myActivePart == aModel)? 0 : (XGUI_PartModel*)aModel;
+
+ if (myActivePart == aModel) {
+ myActivePart = 0;
+ myActivePartIndex = QModelIndex();
+ } else {
+ myActivePart = (XGUI_PartModel*)aModel;
+ myActivePartIndex = theIndex;
+ }
+
if (myActivePart) {
myActivePart->setItemsColor(ACTIVE_COLOR);
myModel->setItemsColor(PASSIVE_COLOR);
if (myActivePart)
return myActivePart->part();
return FeaturePtr();
-}
\ No newline at end of file
+}
+
+void XGUI_DocumentDataModel::deactivatePart()
+{
+ if (myActivePart)
+ myActivePart->setItemsColor(PASSIVE_COLOR);
+ myActivePart = 0;
+ myModel->setItemsColor(ACTIVE_COLOR);
+}