Skip to content

Commit

Permalink
Update the depending models when model is edited textually (#11214)
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Sep 18, 2023
1 parent 67c6a5d commit df8bf6c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6804,6 +6804,8 @@ bool ModelWidget::modelicaEditorTextChanged(LibraryTreeItem **pLibraryTreeItem)
if (mpLibraryTreeItem->isInPackageOneFile()) {
pParentLibraryTreeItem->setClassText(stringToLoad);
updateModelText();
} else if (isNewApi()) {
MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->emitModelStateChanged(mpLibraryTreeItem->getNameStructure());
}
// update child classes
updateChildClasses(mpLibraryTreeItem);
Expand All @@ -6816,6 +6818,11 @@ bool ModelWidget::modelicaEditorTextChanged(LibraryTreeItem **pLibraryTreeItem)
* so we tell unloadLibraryTreeItem to don't try deleteClass since it will only produce error
*/
pLibraryTreeModel->unloadLibraryTreeItem(mpLibraryTreeItem, !mpLibraryTreeItem->isInPackageOneFile());
// If isNewApi() then update the depending model.
if (isNewApi()) {
MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->emitModelStateChanged(mpLibraryTreeItem->getNameStructure());
disconnect(MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel(), SIGNAL(modelStateChanged(QString)), this, SLOT(updateModelIfDependsOn(QString)));
}
mpLibraryTreeItem->setModelWidget(0);
QString name = StringHandler::getLastWordAfterDot(className);
LibraryTreeItem *pNewLibraryTreeItem = pLibraryTreeModel->createLibraryTreeItem(name, mpLibraryTreeItem->parent(), false, false, true, row);
Expand Down

0 comments on commit df8bf6c

Please sign in to comment.