Skip to content

Commit

Permalink
Use the same parent object instead of finding it every time.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Apr 28, 2016
1 parent 6ceece7 commit dd1927f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OMEdit/OMEditGUI/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -1137,14 +1137,17 @@ void LibraryTreeModel::createLibraryTreeItems(LibraryTreeItem *pLibraryTreeItem)
if (!libs.isEmpty()) {
libs.removeFirst();
}
LibraryTreeItem *pParentLibraryTreeItem = 0;
foreach (QString lib, libs) {
/* $Code is a special OpenModelica keyword. No API command will work if we use it. */
if (lib.contains("$Code")) {
continue;
}
QString name = StringHandler::getLastWordAfterDot(lib);
QString parentName = StringHandler::removeLastWordAfterDot(lib);
LibraryTreeItem *pParentLibraryTreeItem = findLibraryTreeItem(parentName, pLibraryTreeItem);
if (!(pParentLibraryTreeItem && pParentLibraryTreeItem->getNameStructure().compare(parentName) == 0)) {
pParentLibraryTreeItem = findLibraryTreeItem(parentName, pLibraryTreeItem);
}
if (pParentLibraryTreeItem) {
createLibraryTreeItem(name, pParentLibraryTreeItem, pParentLibraryTreeItem->isSaved(), false, false);
}
Expand Down

0 comments on commit dd1927f

Please sign in to comment.