69 lines
2.2 KiB
C++
69 lines
2.2 KiB
C++
#include "samplewidget.h"
|
|
#include <QGridLayout>
|
|
#include <QLabel>
|
|
#include <QGroupBox>
|
|
#include <QMessageBox>
|
|
double g_quality;
|
|
QString g_sname_string;
|
|
|
|
SampleWidget::SampleWidget(QWidget *parent) : QWidget(parent)
|
|
{
|
|
QGridLayout* layout = new QGridLayout(this);
|
|
QLabel* label1 = new QLabel(this);
|
|
label1->setText("样品名称:");
|
|
QLabel* label2 = new QLabel(this);
|
|
label2->setText("样品质量(mg):");
|
|
QLabel* label3 = new QLabel(this);
|
|
label3->setText("测试日期:");
|
|
QLabel* label4 = new QLabel(this);
|
|
label4->setText("操作员:");
|
|
|
|
m_ttlineEdit1 = new QLineEdit(this);
|
|
m_ttlineEdit1->setAlignment( Qt::AlignHCenter);
|
|
m_ttlineEdit1->setStyleSheet("border:1px solid black;");
|
|
m_ttlineEdit2 = new QLineEdit(this);
|
|
m_ttlineEdit2->setAlignment( Qt::AlignHCenter);
|
|
m_ttlineEdit2->setStyleSheet("border:1px solid black;");
|
|
m_ttlineEdit3 = new QLineEdit(this);
|
|
m_ttlineEdit3->setAlignment( Qt::AlignHCenter);
|
|
m_ttlineEdit3->setStyleSheet("border:1px solid black;");
|
|
m_ttlineEdit4 = new QLineEdit(this);
|
|
m_ttlineEdit4->setAlignment( Qt::AlignHCenter);
|
|
m_ttlineEdit4->setStyleSheet("border:1px solid black;");
|
|
m_ttlineEdit4->setText("");
|
|
m_ttlineEdit4->setAlignment( Qt::AlignHCenter);
|
|
|
|
saveButton = new QPushButton(this);
|
|
saveButton->setText("保存");
|
|
|
|
layout->addWidget(label1, 0, 0);
|
|
layout->addWidget(label2, 1, 0);
|
|
layout->addWidget(label3, 2, 0);
|
|
layout->addWidget(label4, 3, 0);
|
|
layout->addWidget(m_ttlineEdit1, 0, 1);
|
|
layout->addWidget(m_ttlineEdit2, 1, 1);
|
|
layout->addWidget(m_ttlineEdit3, 2, 1);
|
|
layout->addWidget(m_ttlineEdit4, 3, 1);
|
|
layout->addWidget(saveButton, 4, 1);
|
|
|
|
connect(saveButton, SIGNAL(clicked()), this, SLOT(save_sample_info_to_file()));
|
|
}
|
|
SampleWidget::~SampleWidget()
|
|
{
|
|
|
|
}
|
|
|
|
void SampleWidget::save_sample_info_to_file()
|
|
{
|
|
g_quality = m_ttlineEdit2->text().toDouble();
|
|
g_sname_string = m_ttlineEdit1->text();
|
|
QMessageBox::information(this,"提示","保存成功!");
|
|
}
|
|
|
|
void SampleWidget::show_read_sample_param_slot(QString sname, double quality)
|
|
{
|
|
m_ttlineEdit1->setText(sname);
|
|
m_ttlineEdit2->setText(QString("%1").arg(quality));
|
|
}
|
|
|