Skip to content

Commit

Permalink
Read the error from the graphics annotation element (#12353)
Browse files Browse the repository at this point in the history
Adapt to the new output introduced in #12325
  • Loading branch information
adeas31 committed Apr 30, 2024
1 parent 26007b1 commit 6c4e231
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions OMEdit/OMEditLIB/Modeling/Model.cpp
Expand Up @@ -641,12 +641,7 @@ namespace ModelInstance
}

if (jsonObject.contains("graphics")) {
if (jsonObject.value("graphics").isObject()) {
QJsonObject graphicsObject = jsonObject.value("graphics").toObject();
if (graphicsObject.contains("$error")) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, graphicsObject.value("$error").toString(), Helper::scriptingKind, Helper::errorLevel));
}
} else if (jsonObject.value("graphics").isArray()) {
if (jsonObject.value("graphics").isArray()) {
QJsonArray graphicsArray = jsonObject.value("graphics").toArray();
for (int i = 0; i < graphicsArray.size(); ++i) {
QJsonObject graphicObject = graphicsArray.at(i).toObject();
Expand Down Expand Up @@ -677,6 +672,8 @@ namespace ModelInstance
pBitmap->deserialize(graphicObject.value("elements").toArray());
mGraphics.append(pBitmap);
}
} else if (graphicObject.contains("$error")) {
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, graphicObject.value("$error").toString(), Helper::scriptingKind, Helper::errorLevel));
}
}
}
Expand Down

0 comments on commit 6c4e231

Please sign in to comment.