2025-06-19 01:38:50 +08:00
|
|
|
|
#include "resultitem.h"
|
|
|
|
|
|
#include "ui_resultitem.h"
|
|
|
|
|
|
|
|
|
|
|
|
ResultItem::ResultItem(QWidget *parent)
|
|
|
|
|
|
: QWidget(parent)
|
|
|
|
|
|
, ui(new Ui::ResultItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
// 强制应用样式表 - 这是关键!
|
|
|
|
|
|
this->setAttribute(Qt::WA_StyledBackground, true);
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化时设置样式
|
|
|
|
|
|
setItemStyle();
|
|
|
|
|
|
|
|
|
|
|
|
// 设置输入框为只读
|
|
|
|
|
|
ui->result_x->setReadOnly(true);
|
|
|
|
|
|
ui->result_y->setReadOnly(true);
|
|
|
|
|
|
ui->result_z->setReadOnly(true);
|
|
|
|
|
|
ui->result_rz->setReadOnly(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ResultItem::~ResultItem()
|
|
|
|
|
|
{
|
|
|
|
|
|
delete ui;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ResultItem::setResultData(int targetIndex, const GrabBagPosition& position)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 设置目标编号
|
|
|
|
|
|
ui->result_id->setText(QString("目标:%1").arg(targetIndex));
|
|
|
|
|
|
|
|
|
|
|
|
// 设置数据到对应的LineEdit控件
|
|
|
|
|
|
ui->result_x->setText(QString("%1").arg(position.x, 0, 'f', 2));
|
|
|
|
|
|
ui->result_y->setText(QString("%1").arg(position.y, 0, 'f', 2));
|
|
|
|
|
|
ui->result_z->setText(QString("%1").arg(position.z, 0, 'f', 2));
|
|
|
|
|
|
ui->result_rz->setText(QString("%1").arg(position.yaw, 0, 'f', 2));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ResultItem::setItemStyle()
|
|
|
|
|
|
{
|
2025-06-26 00:40:36 +08:00
|
|
|
|
// 只设置右侧和下侧边框作为格子间分隔线,不修改背景和QLineEdit样式
|
2025-06-19 01:38:50 +08:00
|
|
|
|
this->setStyleSheet(
|
|
|
|
|
|
"ResultItem { "
|
2025-06-26 00:40:36 +08:00
|
|
|
|
" border: 6px solid #191A1C; " // 右侧边框
|
|
|
|
|
|
" border-radius: 0px; " // 去掉圆角,让分隔线更清晰
|
2025-06-19 01:38:50 +08:00
|
|
|
|
"} "
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|