JIoMapPage.cpp 2.3 KB

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