35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
#include "XyzRpyItem.h"
|
|
#include "ui_XyzRpyItem.h"
|
|
|
|
XyzRpyItem::XyzRpyItem(QWidget *parent)
|
|
: QWidget(parent)
|
|
, ui(new Ui::XyzRpyItem)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
// 强制应用样式表
|
|
this->setAttribute(Qt::WA_StyledBackground, true);
|
|
}
|
|
|
|
XyzRpyItem::~XyzRpyItem()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void XyzRpyItem::setResultData(int index, const QString& titlePrefix,
|
|
const PositionData<double>& position, int precision)
|
|
{
|
|
// 设置标题:前缀 + 编号
|
|
ui->result_id->setText(QString("%1 %2").arg(titlePrefix).arg(index));
|
|
|
|
// 坐标:每行一个轴
|
|
ui->result_x->setText(QString("X: %1").arg(position.x, 0, 'f', precision));
|
|
ui->result_y->setText(QString("Y: %1").arg(position.y, 0, 'f', precision));
|
|
ui->result_z->setText(QString("Z: %1").arg(position.z, 0, 'f', precision));
|
|
|
|
// 姿态角:每行一个
|
|
ui->result_r->setText(QString("R: %1").arg(position.roll, 0, 'f', precision));
|
|
ui->result_p->setText(QString("P: %1").arg(position.pitch, 0, 'f', precision));
|
|
ui->result_yaw->setText(QString("Y: %1").arg(position.yaw, 0, 'f', precision));
|
|
}
|