#include "component_display.h" #include "attribute_dialog.h" #include "name_dialog.h" #include #include #include #include namespace display { void Component::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { QMenu menu; menu.addAction("Izmjeni ime", [this](){ auto dialog = new NameDialog(this->instance.get()); dialog->exec(); }); menu.addSeparator(); for(int i=0; iinstance->attributes.size(); i++) { auto* attr = &this->instance->attributes[i]; bool enabled = attr->attribute.getPopup().has_value(); auto action = menu.addAction(QString::fromStdString("Izmjeni " + attr->name), [attr]() { auto dialog = new AttributeDialog(attr); dialog->exec(); }); action->setEnabled(enabled); } menu.exec(event->screenPos()); } void Bus::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { QMenu menu; menu.addAction("Izmjeni ime", [this](){ auto dialog = new NameDialog(this->busInstance.get()); dialog->exec(); }); menu.exec(event->screenPos()); } } // namespace display