Newer
Older
AutomaticVerification / softwareDirectory / AutoVerScheme / inspectdataitem.cpp
李现川 on 6 Mar 2024 2 KB no commit message
#include "inspectdataitem.h"
#include "ui_inspectdataitem.h"
#include "QMessageBox.h"

InspectDataItem::InspectDataItem(QWidget *parent) :
    InfoBase(parent),
    ui(new Ui::InspectDataItem)
{
    ui->setupUi(this);
    this->initForm();
}

InspectDataItem::~InspectDataItem()
{
    delete ui;
}
void InspectDataItem::initForm()
{
    //tableWidget设置
    //设置控件的边框显示
    ui->tableWidget->setStyleSheet("QHeaderView::section {"
                                "border: 1px solid rgba(197, 196, 196, 1);"
                                "border-left:none;"
                                "border-top:none;"
                                "background-color:white;"
                               "}");

    ui->tableWidget->setRowCount(10); // 设置10行
    ui->tableWidget->setColumnCount(12); // 设置11列
    ui->tableWidget->setColumnWidth(0, 80); // 设置第一列的宽度为100像素
    ui->tableWidget->verticalHeader()->setParent(nullptr); //隐藏行头
    QTableWidgetItem *item = new QTableWidgetItem("测试数据");
    item->setTextAlignment(Qt::AlignCenter);
    ui->tableWidget->setItem(0, 0, item); //设置数据

    //初始化TableWidget 设置列
    QStringList headers;
    headers << "序号" << "设备名称" << "型号规则" << "出厂编号"
            <<"核查件名称"<<"核查件型号"<<"核查件编号" <<"核查员"
           << "核查日期" <<"实验室"<<"部门"<<"操作";
    ui->tableWidget->setHorizontalHeaderLabels(headers);
}
void InspectDataItem::ShowMessageBox(QString title,QString value) {
    // 创建一个QMessageBox对象
    QMessageBox msgBox;

    // 设置消息框的标题
    msgBox.setWindowTitle(title);

    // 设置消息框的文本内容
    msgBox.setText(value);

    // 设置消息框的标准按钮,这里是“确定”按钮
    msgBox.setStandardButtons(QMessageBox::Ok);

    // 显示消息框
    msgBox.exec();
}
void InspectDataItem::Load()
{
     //ShowMessageBox("核查数据","核查数据");
}