schema_editor/comdel/display/schema_display.cpp

29 lines
620 B
C++

#include "component_display.h"
#include "schema_display.h"
namespace display {
Schema::Schema()
{
this->setScene(&scene);
}
void Schema::setSchema(domain::Schema* _schema)
{
scene.clear();
this->schema = _schema;
if(schema != nullptr) {
for(auto &instance: schema->componentInstances) {
scene.addItem(new display::ComponentGroup(instance));
}
for(auto &instance: schema->busInstances) {
if(instance->bus.getDisplay().has_value()) {
scene.addItem(new display::BusGroup(instance));
}
}
}
}
} // namespace display