diff --git a/item.h b/item.h index 0e2a88c..b28b52e 100644 --- a/item.h +++ b/item.h @@ -26,6 +26,7 @@ public: void setRegisterValue(quint16 value); quint16 registerValue() const { return registerValue_; } + // 添加状态属性(用于线圈、触点等) virtual bool state() const { return false; } diff --git a/plc.cpp b/plc.cpp index 3c978dc..b8e05ed 100644 --- a/plc.cpp +++ b/plc.cpp @@ -133,6 +133,7 @@ void PLC::applyProjectToScene(const Project& proj) connect(item, &Item::requestDelete, ui->graphicsView, &MyGraphicsView::onItemRequestDelete); connect(item, &Item::requestBindRegister, ui->graphicsView, &MyGraphicsView::onItemRequestBindRegister); plc_scene_->addItem(item); + registerManager->bindItem(item,d.registerId); itemObjs.append(item); } for (const auto& c : proj.connections_) {