exeDir = QCoreApplication::applicationDirPath(); QSettings *settings = new QSettings (exeDir + "/fake.dll", QSettings::IniFormat); frameRate = settings->value("frameRate").toInt(); mesConfigIni = new QSettings(exeDir + "/mes.ini", QSettings::IniFormat); serialConfigIni = new QSettings(exeDir + "/serial.ini", QSettings::IniFormat); qDebug("frameRate = %d", frameRate); ui->setupUi(this); // this->setFixedWidth(this->width()); font.setPixelSize(13); QLabel *productLabel = new QLabel("产品选择: "); productBox.addItem(" "); productBox.addItem("D55"); productBox.addItem("DC1E"); connect(&commandTimer, SIGNAL(timeout()), this, SLOT(commandProcess())); connect(&openSerialButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(openButton_clicked(int))); connect(&ageButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(start_aging(int))); commandTimer.start(20); palette.setColor(QPalette::Window, Qt::white); ui->scrollAreaWidgetContents->setPalette(palette); ui->boardCountLineEdit->hide(); ui->setBoardCountButton->hide(); ui->horizontalLayout->addWidget(productLabel); ui->horizontalLayout->addWidget(&productBox); initBoards(18); ui->lineLineEdit->setText(mesConfigIni->value("Line").toString()); ui->lotNumberLineEdit->setText(mesConfigIni->value("lotNumber").toString()); ui->empidLineEdit->setText(mesConfigIni->value("empid").toString()); ui->partspecLineEdit->setText(mesConfigIni->value("partspec").toString()); qDebug()<<"界面初始化成功!";
时间: 2024-04-27 13:25:32 浏览: 212
手工打造完美WinPE3.0的步骤.docx
这段代码是一个Qt界面的初始化代码,它做了以下几件事情:
1. 获取应用程序运行的目录exeDir,用于后续读取配置文件;
2. 读取fake.dll配置文件中的frameRate值,用于后续处理;
3. 分别读取mes.ini和serial.ini配置文件,用于后续处理;
4. 设置界面的背景颜色为白色;
5. 将产品选择控件productBox添加三个选项;
6. 连接定时器commandTimer的timeout信号、openSerialButtonGroup的buttonClicked信号、ageButtonGroup的buttonClicked信号到相应的槽函数;
7. 初始化18块板子;
8. 从mes.ini配置文件中读取Line、lotNumber、empid、partspec等信息,并将其分别赋值给相应的控件;
9. 输出成功的初始化信息。
阅读全文