代码拉取完成,页面将自动刷新
#include "dialogprm.h"
#include "ui_dialogprm.h"
#include "mainframdata.h"
#include "mainwindow.h"
DialogPrm::DialogPrm(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogPrm)
{
ui->setupUi(this);
UiInit();
}
DialogPrm::~DialogPrm()
{
delete ui;
}
void DialogPrm::UiInit()
{
ui->pushButton->hide();//防止鼠标自动锁定”保存按钮“
ui->dial_value->setAlignment(Qt::AlignHCenter);
ui->dial_value->setEnabled(false);
ui->lineEdit_acc->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.acc));
ui->lineEdit_dec->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.dec));
ui->lineEdit_velStart->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.velStart));
ui->lineEdit_smoothTime->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.MotorTrapPrm.smoothTime));
ui->comboBox_XDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[0]);
ui->comboBox_YDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[1]);
ui->comboBox_ZDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[2]);
ui->comboBox_UDir->setCurrentIndex(EnvmPrm::m_MotorPara.m_HomePara.Direction[3]);
ui->HomeSpeed->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_HomePara.HomeSpeed));
ui->SEARCH_HOME->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.SEARCH_HOME));
ui->HOME_OFFSET->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.HOME_OFFSET));
ui->SEARCH_INDEX->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.SEARCH_INDEX));
ui->INDEX_OFFSET->setText(QString::number(EnvmPrm::m_MotorPara.m_HomePara.INDEX_OFFSET));
ui->checkBox->setChecked(EnvmPrm::m_MotorPara.m_MovoPara.Power);
ui->dial->setNotchesVisible(true);
ui->dial->setRange(1,10);
ui->dial->setNotchTarget(1);
ui->dial->setValue(EnvmPrm::m_MotorPara.m_MovoPara.Ratio);
ui->XSpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[0]));
ui->YSpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[1]));
ui->ZSpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[2]));
ui->USpeed_m->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[3]));
ui->XSpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[0]));
ui->YSpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[1]));
ui->ZSpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[2]));
ui->USpeed_A->setText(EnvmPrm::doubleToQString(EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[3]));
}
void DialogPrm::on_btn_save_clicked()
{
EnvmPrm::m_MotorPara.MotorTrapPrm.acc=ui->lineEdit_acc->text().toDouble();
EnvmPrm::m_MotorPara.MotorTrapPrm.dec=ui->lineEdit_dec->text().toDouble();
EnvmPrm::m_MotorPara.MotorTrapPrm.velStart=ui->lineEdit_velStart->text().toDouble();
EnvmPrm::m_MotorPara.MotorTrapPrm.smoothTime=ui->lineEdit_smoothTime->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.Direction[0]=ui->comboBox_XDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.Direction[1]=ui->comboBox_YDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.Direction[2]=ui->comboBox_ZDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.Direction[3]=ui->comboBox_UDir->currentIndex();
EnvmPrm::m_MotorPara.m_HomePara.HomeSpeed=ui->HomeSpeed->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.SEARCH_HOME=ui->SEARCH_HOME->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.SEARCH_INDEX=ui->SEARCH_INDEX->text().toDouble();
EnvmPrm::m_MotorPara.m_HomePara.INDEX_OFFSET=ui->INDEX_OFFSET->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.Power=ui->checkBox->isChecked();
EnvmPrm::m_MotorPara.m_MovoPara.Ratio=ui->dial->value();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[0]=ui->XSpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[1]=ui->YSpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[2]=ui->ZSpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.ManualSpeed[3]=ui->USpeed_m->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[0]=ui->XSpeed_A->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[1]=ui->YSpeed_A->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[2]=ui->ZSpeed_A->text().toDouble();
EnvmPrm::m_MotorPara.m_MovoPara.AutoSpeed[3]=ui->USpeed_A->text().toDouble();
emit SigSaveDialogPrm();
accept();
}
void DialogPrm::on_dial_valueChanged(int value)
{
ui->dial_value->setText(QString::number(value));
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。