#include "JIoMapPage.h" JIoMapPage::JIoMapPage() {} QWidget* JIoMapPage::CreateIoPage(const CONFIG_BASE_STRUCT& control) { // 1.用到表中的变量 QString strName = control.strName.c_str(); // 2. 创建垂直布局 QHBoxLayout* pHLayout = new QHBoxLayout(); ClickCircleLabel* pIoState = new ClickCircleLabel(); pIoState->setIoName(strName); QLabel* pAxisNmae = new QLabel(); QString strAxisName = tr("AxisNmae:", "轴名称:"); strAxisName += strName; pAxisNmae->setText(strAxisName); //QLabel* pLow = new QLabel(); //pLow->setText(tr("Voltage status", "电压状态")); //QComboBox* pComBox = new QComboBox(); //pComBox->addItem(tr("Low", "低电平")); //pComBox->addItem(tr("High","高电平")); //pComBox->setCurrentIndex(1); //// 连接信号和槽 //connect(pComBox, &QComboBox::currentTextChanged, []() { // }); // 轴名称 pHLayout->addWidget(pAxisNmae); //// 电平组合 //pHLayout->addWidget(pLow); //pHLayout->addWidget(pComBox); // 改变状态标记 pHLayout->addWidget(pIoState); QWidget* pWidget = new QWidget; pWidget->setLayout(pHLayout); return pWidget; } QWidget* JIoMapPage::CreateAxisTestPage(const CONFIG_BASE_STRUCT& control) { // 1.用到表中的变量 QString strName = control.strName.c_str(); QHBoxLayout* pHLayout = new QHBoxLayout(); QLabel* pAxisNmae = new QLabel(); QString strAxisName = tr("AxisNmae:", "轴名称:"); strAxisName += strName; pAxisNmae->setText(strAxisName); pHLayout->addWidget(pAxisNmae); QLineEdit* pCardNumberType = new QLineEdit(tr("Card Number Type", "卡号类型")); pCardNumberType->setText("0"); pHLayout->addWidget(pCardNumberType); QLineEdit* pCardNumber = new QLineEdit(tr("Card Number", "卡号")); pCardNumber->setText("0"); pHLayout->addWidget(pCardNumberType); QPushButton* pTest = new QPushButton(tr("Axis Test","轴测试")); QObject::connect(pTest, &QPushButton::clicked, [strName]() { // 执行弹出窗口 }); pHLayout->addWidget(pTest); QWidget* pWidget = new QWidget; pWidget->setLayout(pHLayout); return pWidget; }