#include "param.h"
#include "relay.h"
#include "serial.h"
#include "bsp.h"
float text_val_buf[21]; //21个参数的浮点数值
Set_Param::~Set_Param(){}
Set_Param::Set_Param(QWidget *parent) : QWidget(parent)
{
Main_Layout = new QVBoxLayout();
Main_Widget = new QGroupBox(this);
// Main_Widget->setStyleSheet("QGroupBox { border: 5px solid white; }");
Main_Widget->setAlignment(Qt::AlignCenter);
Main_Widget->show();
Gui_Layout = new QHBoxLayout();
Left_Layout = new QVBoxLayout();
Right_Layout = new QVBoxLayout();
Left_Widget = new QWidget(this);
Right_Widget = new QWidget(this);
///////////////////////////////////////////////左侧窗口
Area1_Layout = new QVBoxLayout();
Area1_Widget = new QGroupBox(tr("参数一"),this); //参数区域1框
Area1_Widget->setAlignment(Qt::AlignCenter);
Area1_Widget->show();
Area2_Layout = new QVBoxLayout();
Area2_Widget = new QGroupBox(tr("参数二"),this);
Area2_Widget->setAlignment(Qt::AlignCenter);
Area2_Widget->show();
/*
Title_Lab = new QLabel(this);
Title_Lab->setAlignment(Qt::AlignCenter);
QString title_name = "PCB电路板测试软件";
QFont font;
font.setFamily("仿宋");
font.setPointSize(16);
font.setBold(true);
Title_Lab->setText(title_name);
Title_Lab->setFont(font);
Title_Lab->setAlignment(Qt::AlignCenter);
*/
/////////////////////////////////////////////后期增加的
Area3_Layout = new QVBoxLayout();
Area3_Widget = new QGroupBox(tr("参数三"),this);
Area3_Widget->setAlignment(Qt::AlignCenter);
Area3_Widget->show();
///////////////////////////////////////////////参数一区域
Param1_Layout = new QGridLayout();
Param1_Widget = new QWidget(this);
QList <QString> lablist;
lablist<<"1#继电器"<<"2#继电器"<<"3#继电器"<<"4#继电器"<<"5#继电器"
<<"6#继电器"<<"7#继电器"<<"8#继电器"<<"9#继电器";
for(int i=0;i<9;i++)
{
Lab1_Buf[i] = new QLabel(this);
Lab1_Buf[i]->setMinimumSize(LAB_W,LAB_H);
Lab1_Buf[i]->setAlignment(Qt::AlignBottom);
Lab1_Buf[i]->setText(lablist[i]);
Edit1_Buf[i] = new QLineEdit(this);
Edit1_Buf[i]->setMinimumSize(LINE_W,LINE_H);
Edit1_Buf[i]->setAlignment(Qt::AlignCenter);
}
Param1_Layout->addWidget(Lab1_Buf[0],0,0);
Param1_Layout->addWidget(Lab1_Buf[1],0,1);
Param1_Layout->addWidget(Lab1_Buf[2],0,2);
Param1_Layout->addWidget(Lab1_Buf[3],2,0);
Param1_Layout->addWidget(Lab1_Buf[4],2,1);
Param1_Layout->addWidget(Lab1_Buf[5],2,2);
Param1_Layout->addWidget(Lab1_Buf[6],4,0);
Param1_Layout->addWidget(Lab1_Buf[7],4,1);
Param1_Layout->addWidget(Lab1_Buf[8],4,2);
Param1_Layout->addWidget(Edit1_Buf[0],1,0);
Param1_Layout->addWidget(Edit1_Buf[1],1,1);
Param1_Layout->addWidget(Edit1_Buf[2],1,2);
Param1_Layout->addWidget(Edit1_Buf[3],3,0);
Param1_Layout->addWidget(Edit1_Buf[4],3,1);
Param1_Layout->addWidget(Edit1_Buf[5],3,2);
Param1_Layout->addWidget(Edit1_Buf[6],5,0);
Param1_Layout->addWidget(Edit1_Buf[7],5,1);
Param1_Layout->addWidget(Edit1_Buf[8],5,2);
// Param1_Layout->setContentsMargins(20,20,20,20); //设置框内部四周空余距离 左20上30右20下30
Param1_Layout->setHorizontalSpacing(JIAN_GE); //设置列之间间隙大小
Param1_Widget->setLayout(Param1_Layout);
Area1_Layout->addWidget(Param1_Widget);
Area1_Widget->setLayout(Area1_Layout);
////////////////////////////////////////////////参数二区域
Param2_Layout = new QGridLayout();
Param2_Widget = new QWidget(this);
QList <QString> lablist2;
lablist2<<"1#继电器"<<"2#继电器"<<"3#继电器"<<"4#继电器"<<"5#继电器"<<"6#继电器"
<<"7#继电器"<<"8#继电器"<<"9#继电器"<<"7#继电器"<<"8#继电器"<<"9#继电器";
for(int i=0;i<12;i++)
{
Lab2_Buf[i] = new QLabel(this);
Lab2_Buf[i]->setMinimumSize(LAB_W,LAB_H);
Lab2_Buf[i]->setAlignment(Qt::AlignBottom);
Lab2_Buf[i]->setText(lablist2[i]);
Edit2_Buf[i] = new QLineEdit(this);
Edit2_Buf[i]->setMinimumSize(LINE_W,LINE_H);
Edit2_Buf[i]->setAlignment(Qt::AlignCenter);
}
Param2_Layout->addWidget(Lab2_Buf[0],0,0);
Param2_Layout->addWidget(Lab2_Buf[1],0,1);
Param2_Layout->addWidget(Lab2_Buf[2],0,2);
Param2_Layout->addWidget(Lab2_Buf[3],2,0);
Param2_Layout->addWidget(Lab2_Buf[4],2,1);
Param2_Layout->addWidget(Lab2_Buf[5],2,2);
Param2_Layout->addWidget(Lab2_Buf[6],4,0);
Param2_Layout->addWidget(Lab2_Buf[7],4,1);
Param2_Layout->addWidget(Lab2_Buf[8],4,2);
Param2_Layout->addWidget(Lab2_Buf[9],6,0);
Param2_Layout->addWidget(Lab2_Buf[10],6,1);
Param2_Layout->addWidget(Lab2_Buf[11],6,2);
Param2_Layout->addWidget(Edit2_Buf[0],1,0);
Param2_Layout->addWidget(Edit2_Buf[1],1,1);
Param2_Layout->addWidget(Edit2_Buf[2],1,2);
Param2_Layout->addWidget(Edit2_Buf[3],3,0);
Param2_Layout->addWidget(Edit2_Buf[4],3,1);
Param2_Layout->addWidget(Edit2_Buf[5],3,2);
Param2_Layout->addWidget(Edit2_Buf[6],5,0);
Param2_Layout->addWidget(Edit2_Buf[7],5,1);
Param2_Layout->addWidget(Edit2_Buf[8],5,2);
Param2_Layout->addWidget(Edit2_Buf[9],7,0);
Param2_Layout->addWidget(Edit2_Buf[10],7,1);
Param2_Layout->addWidget(Edit2_Buf[11],7,2);
// Param2_Layout->setContentsMargins(20,20,20,20); //设置框内部四周空余距离 左20上30右20下30
Param2_Layout->setHorizontalSpacing(JIAN_GE); //设置列之间间隙大小
Param2_Widget->setLayout(Param2_Layout);
Area2_Layout->addWidget(Param2_Widget);
Area2_Widget->setLayout(Area2_Layout);
///////////////////////////////////////////////////////参数三区域 后期增加的
Param3_Layout = new QGridLayout();
Param3_Widget = new QWidget(this);
QList <QString> lablist3;
lablist3<<"1#继电器时间"<<"2#继电器时间"<<"3#继电器时间"<<"4#继电器时间"<<"5#继电器时间"
<<"6#继电器时间"<<"7#继电器时间"<<"8#继电器时间"<<"9#继电器时间"<<"10#继电器时间"<<"11#继电器时间"<<"12#继电器时间";
for(int i=0;i<12;i++)
{
Lab3_Buf[i] = new QLabel(this);
Lab3_Buf[i]->setMinimumSize(LAB_W,LAB_H);
Lab3_Buf[i]->setAlignment(Qt::AlignBottom);
Lab3_Buf[i]->setText(lablist3[i]);
}
for(int i=0;i<5;i++)
{
Edit3_Buf[i] = new QLineEdit(this);
Edit3_Buf[i]->setMinimumSize(LINE_W,LINE_H);
Edit3_Buf[i]->setAlignment(Qt::AlignCenter);
}
for(int i=0;i<4;i++)
{
Time_Widget[i] = new QTimeEdit(this);
Time_Widget[i]->setMinimumSize(LINE_W,LINE_H);
Time_Widget[i]->setAlignment(Qt::AlignCenter);
Time_Widget[i]->setDisplayFormat("hh:mm:ss");
}
Date_Widget = new QDateEdit(this);
Date_Widget->setMinimumSize(LINE_W,LINE_H);
Date_Widget->setAlignment(Qt::AlignCenter);
Date_Widget->setDisplayFormat("yyyy-MM-dd");
QuYang_ComBox = new QComboBox(this);
QuYang_ComBox->setMinimumSize(LINE_W,LINE_H);
QuYang_ComBox->addItem("方式一");
QuYang_ComBox->addItem("方式二");
PoHuai_ComBox = new QComboBox(this);
PoHuai_ComBox->setMinimumSize(LINE_W,LINE_H);
PoHuai_ComBox->addItem("类型一");
PoHuai_ComBox->addItem("类型二");
PoHuai_ComBox->addItem("类型三");
PoHuai_ComBox->addItem("类型四");
connect(QuYang_ComBox, SIGNAL(currentIndexChanged(int)), this, SLOT(qu_yang_combox_changed(int)));
connect(PoHuai_ComBox, SIGNAL(currentIndexChanged(int)), this, SLOT(po_huai_combox_changed(int)));
connect(Date_Widget, SIGNAL(dateChanged(QDate)), this, SLOT(date