You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 regels
397 B

  1. #include "creatitem.h"
  2. Item *creatItem(const QString &type)
  3. {
  4. if (type == "常开") return new Contact(type);
  5. if (type == "常闭") return new Contact(type);
  6. if (type == "线圈") return new Coil(type);
  7. if (type == "比较") return new Comparator(type);
  8. if (type == "按钮") return new Button(type);
  9. if (type == "指示灯") return new Light(type);
  10. return nullptr;
  11. }