2026-05-18 23:39:05 +08:00

52 lines
1.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "weldseamitem.h"
#include "ui_weldseamitem.h"
WeldSeamItem::WeldSeamItem(QWidget *parent)
: QWidget(parent)
, ui(new Ui::WeldSeamItem)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_StyledBackground, true);
}
WeldSeamItem::~WeldSeamItem()
{
delete ui;
}
void WeldSeamItem::setResultData(int index, const WeldSeamDisplayData& data, int precision)
{
// 焊缝类型文字
QString weldTypeStr;
switch (data.weldType) {
case 1: weldTypeStr = "点焊"; break;
case 2: weldTypeStr = "焊缝"; break;
case 3: weldTypeStr = "焊缝(间隙)"; break;
default: weldTypeStr = "未知"; break;
}
// 标题:焊缝 N [类型]
ui->result_id->setText(QString("焊缝 %1 [%2]").arg(index).arg(weldTypeStr));
// 中心点
ui->result_center->setText(QString("中心: (%1, %2, %3)")
.arg(data.centerX, 0, 'f', precision)
.arg(data.centerY, 0, 'f', precision)
.arg(data.centerZ, 0, 'f', precision));
// 起点→终点
ui->result_startEnd->setText(QString("起止: (%1, %2, %3) → (%4, %5, %6)")
.arg(data.startPtX, 0, 'f', precision)
.arg(data.startPtY, 0, 'f', precision)
.arg(data.startPtZ, 0, 'f', precision)
.arg(data.endPtX, 0, 'f', precision)
.arg(data.endPtY, 0, 'f', precision)
.arg(data.endPtZ, 0, 'f', precision));
// 欧拉角 RPY
ui->result_rpy->setText(QString("RPY: (%1, %2, %3)")
.arg(data.roll, 0, 'f', precision)
.arg(data.pitch, 0, 'f', precision)
.arg(data.yaw, 0, 'f', precision));
}