#include "attribute_wgt.h" #include "ui_attribute_wgt.h" #include #include #include Attribute_wgt::Attribute_wgt(QWidget *parent) : QWidget(parent) , ui(new Ui::Attribute_wgt) { ui->setupUi(this); init_ui(); } Attribute_wgt::~Attribute_wgt() { delete ui; } void Attribute_wgt::init_ui() { // 创建 QStringList属性列表 QStringList stringList; set_param_ui(stringList); QVBoxLayout *layout_par = new QVBoxLayout; // 遍历 QStringList 并创建 QLabel 显示每个项 for (const QString &str : stringList) { QLabel *label = new QLabel(str); // 创建 QLabel QLineEdit *LineEdt = new QLineEdit; LineEdt->setMaximumWidth(100); QHBoxLayout *small_layout = new QHBoxLayout; small_layout->addWidget(label); small_layout->addWidget(LineEdt); layout_par->addLayout(small_layout); // 将 QLabel 添加到布局中 } setLayout(layout_par); } void Attribute_wgt::set_param_ui(QStringList &stringList) { stringList << "Pick Process type" << "Pick force " << "Pick up time" << "Needle top height" << "Pick force" << "Pick process time" << "Pick Z touch height" << "Actual tool orientation" << "Die on bond head" << "Install peper pot" << "Die ejector height ofset" << "..." ; }