Added connection display
This commit is contained in:
parent
f11551fef6
commit
1100a9f0b9
|
@ -82,13 +82,26 @@ void Bus::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
|
|||
|
||||
auto action = menu.addAction(QString::fromStdString("Izmjeni " + attr->name),
|
||||
[attr]() {
|
||||
if(attr->value.getType() == domain::Value::MEMORY_REFERENCE) {
|
||||
auto dialog = new MemoryDialog(attr, MainWindow::getSchema()->componentInstances);
|
||||
dialog->exec();
|
||||
} else {
|
||||
auto dialog = new AttributeDialog(attr);
|
||||
dialog->exec();
|
||||
}
|
||||
auto dialog = new AttributeDialog(attr);
|
||||
dialog->exec();
|
||||
});
|
||||
action->setEnabled(enabled);
|
||||
}
|
||||
menu.exec(event->screenPos());
|
||||
}
|
||||
|
||||
void DirectConnection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
|
||||
QMenu menu;
|
||||
menu.addAction("Ukloni poveznicu", [this](){});
|
||||
menu.addSeparator();
|
||||
for(int i=0; i<this->connection->attributes.size(); i++) {
|
||||
auto* attr = &this->connection->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);
|
||||
}
|
||||
|
|
|
@ -116,6 +116,32 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class DirectConnection: public QGraphicsLineItem
|
||||
{
|
||||
private:
|
||||
domain::DirectConnectionInstance* connection;
|
||||
ComponentGroup* first;
|
||||
ComponentGroup* second;
|
||||
BusGroup* bus;
|
||||
|
||||
public:
|
||||
DirectConnection(domain::DirectConnectionInstance* connection, ComponentGroup *first, ComponentGroup *second, BusGroup *bus): connection(connection), first(first), second(second), bus(bus) {
|
||||
updateConnection();
|
||||
setHandlesChildEvents(false);
|
||||
}
|
||||
|
||||
void updateConnection() {
|
||||
auto pin1 = connection->instance->component.getPin(connection->connection.getComponent().pin).getDisplayPin();
|
||||
auto pin2 = connection->secondInstance->component.getPin(connection->connection.getSecondComponent()->pin).getDisplayPin();
|
||||
|
||||
setLine(connection->instance->position.first + pin1.getConnectionX(), connection->instance->position.second + pin1.getConnectionY(),
|
||||
connection->secondInstance->position.first + pin2.getConnectionX(), connection->secondInstance->position.second + pin2.getConnectionY());
|
||||
}
|
||||
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
|
||||
};
|
||||
|
||||
|
||||
} // namespace display
|
||||
|
||||
#endif // DISPLAY_COMPONENT_H
|
||||
|
|
|
@ -193,6 +193,8 @@ void MainWindow::onValidateSchema(bool /*toggled*/) {
|
|||
return;
|
||||
}
|
||||
|
||||
log->clear();
|
||||
|
||||
this->validationErrors.clear();
|
||||
|
||||
domain::ComdelValidator validator{validators};
|
||||
|
|
Loading…
Reference in New Issue