#include "creatitem.h" Item *creatItem(const QString &type) { if (type == "常开") return new Contact(type); if (type == "常闭") return new Contact(type); if (type == "线圈") return new Coil(type); if (type == "比较") return new Comparator(type); if (type == "按钮") return new Button(type); if (type == "指示灯") return new Light(type); return nullptr; }