MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / saveToMemory

Method saveToMemory

QtNodeEditor/src/FlowScene.cpp:528–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526
527
528QByteArray
529FlowScene::
530saveToMemory() const
531{
532 QJsonObject sceneJson;
533
534 QJsonArray nodesJsonArray;
535
536 for (auto const & pair : _nodes)
537 {
538 const FlowScene::UniqueNode &node = pair.second;
539 if(node)
540 {
541 nodesJsonArray.append(node->save());
542 }
543 }
544
545 sceneJson["layout"] = (layout() == PortLayout::Horizontal) ?
546 QStringLiteral("Horizontal") : QStringLiteral("Vertical");
547
548 sceneJson["nodes"] = nodesJsonArray;
549
550 QJsonArray connectionJsonArray;
551 for (auto const & pair : _connections)
552 {
553 auto const &connection = pair.second;
554 if(connection)
555 {
556 QJsonObject connectionJson = connection->save();
557
558 if (!connectionJson.isEmpty())
559 connectionJsonArray.append(connectionJson);
560 }
561 }
562
563 sceneJson["connections"] = connectionJsonArray;
564
565 QJsonDocument document(sceneJson);
566
567 return document.toJson();
568}
569
570
571void

Callers

nothing calls this directly

Calls 1

saveMethod · 0.45

Tested by

no test coverage detected