JIoMapPage.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #include "JIoMapPage.h"
  2. JIoMapPage::JIoMapPage() {}
  3. QWidget* JIoMapPage::CreateIoPage(const CONFIG_BASE_STRUCT& control)
  4. {
  5. // 1.用到表中的变量
  6. QString strName = control.strName.c_str();
  7. // 2. 创建垂直布局
  8. QHBoxLayout* pHLayout = new QHBoxLayout();
  9. ClickCircleLabel* pIoState = new ClickCircleLabel();
  10. pIoState->setIoName(strName);
  11. QLabel* pAxisNmae = new QLabel();
  12. QString strAxisName = tr("AxisNmae:", "轴名称:");
  13. strAxisName += strName;
  14. pAxisNmae->setText(strAxisName);
  15. //QLabel* pLow = new QLabel();
  16. //pLow->setText(tr("Voltage status", "电压状态"));
  17. //QComboBox* pComBox = new QComboBox();
  18. //pComBox->addItem(tr("Low", "低电平"));
  19. //pComBox->addItem(tr("High","高电平"));
  20. //pComBox->setCurrentIndex(1);
  21. //// 连接信号和槽
  22. //connect(pComBox, &QComboBox::currentTextChanged, []() {
  23. // });
  24. // 轴名称
  25. pHLayout->addWidget(pAxisNmae);
  26. //// 电平组合
  27. //pHLayout->addWidget(pLow);
  28. //pHLayout->addWidget(pComBox);
  29. // 改变状态标记
  30. pHLayout->addWidget(pIoState);
  31. QWidget* pWidget = new QWidget;
  32. pWidget->setLayout(pHLayout);
  33. return pWidget;
  34. }
  35. QWidget* JIoMapPage::CreateAxisTestPage(const CONFIG_BASE_STRUCT& control)
  36. {
  37. // 1.用到表中的变量
  38. QString strName = control.strName.c_str();
  39. QHBoxLayout* pHLayout = new QHBoxLayout();
  40. QLabel* pAxisNmae = new QLabel();
  41. QString strAxisName = tr("AxisNmae:", "轴名称:");
  42. strAxisName += strName;
  43. pAxisNmae->setText(strAxisName);
  44. pHLayout->addWidget(pAxisNmae);
  45. QLineEdit* pCardNumberType = new QLineEdit(tr("Card Number Type", "卡号类型"));
  46. pCardNumberType->setText("0");
  47. pHLayout->addWidget(pCardNumberType);
  48. QLineEdit* pCardNumber = new QLineEdit(tr("Card Number", "卡号"));
  49. pCardNumber->setText("0");
  50. pHLayout->addWidget(pCardNumberType);
  51. QPushButton* pTest = new QPushButton(tr("Axis Test","轴测试"));
  52. QObject::connect(pTest, &QPushButton::clicked, [strName]()
  53. {
  54. // 执行弹出窗口
  55. });
  56. pHLayout->addWidget(pTest);
  57. QWidget* pWidget = new QWidget;
  58. pWidget->setLayout(pHLayout);
  59. return pWidget;
  60. }