31 #include <QtSvg/QSvgGenerator>
37 QGraphicsScene(parent)
39 setItemIndexMethod(QGraphicsScene::ItemIndexMethod::NoIndex);
44 return toplevelStateInstance;
51 this->toplevelStateInstance = instance;
53 addItem(toplevelItem);
54 topLevelStateItem = toplevelItem;
59 QImage img(width, width * sceneRect().height() / sceneRect().width(), QImage::Format_ARGB32);
63 QPainter painter(&img);
64 painter.setRenderHint(QPainter::Antialiasing);
71 std::function<void(
StateItem*)> clearRecursive;
78 for (
auto substateItem : item->getSubstateItems())
80 clearRecursive(substateItem);
82 item->clearActiveSubstate();
85 if (topLevelStateItem)
87 clearRecursive(topLevelStateItem);
93 QMap<QString, StateInstanceData> stateInstanceData;
95 std::function<QMap<QString, StateInstanceData>(
StateItem*)> getChildren;
98 QMap<QString, StateInstanceData> stateInstanceData;
101 auto fullpath = substateItem->getFullStatePath();
103 data.active = substateItem->isActive();
104 data.fullStatePath = fullpath;
105 data.stateInstance = substateItem->getStateInstance();
106 stateInstanceData[fullpath] =
data;
107 auto map = getChildren(substateItem);
108 for (
auto& key : map.keys())
110 stateInstanceData[key] = map[key];
113 return stateInstanceData;
116 if (topLevelStateItem)
118 stateInstanceData = getChildren(topLevelStateItem);
121 data.active = topLevelStateItem->isActive();
122 data.fullStatePath = fullpath;
124 stateInstanceData[fullpath] =
data;
127 return stateInstanceData;
132 return topLevelStateItem;