105 lines
2.3 KiB
C++
105 lines
2.3 KiB
C++
|
#include "machinestartdialog.h"
|
|||
|
#include "ui_machinestartdialog.h"
|
|||
|
#include "ccommunicateapi.h"
|
|||
|
#include <QPainter>
|
|||
|
|
|||
|
|
|||
|
MachineStartDialog::MachineStartDialog(QWidget *parent) :
|
|||
|
QDialog(parent),
|
|||
|
ui(new Ui::MachineStartDialog)
|
|||
|
{
|
|||
|
ui->setupUi(this);
|
|||
|
this->setWindowFlags(Qt::FramelessWindowHint); //设置无边框
|
|||
|
this->setAttribute(Qt::WA_TranslucentBackground,true);
|
|||
|
}
|
|||
|
|
|||
|
MachineStartDialog::~MachineStartDialog()
|
|||
|
{
|
|||
|
delete ui;
|
|||
|
}
|
|||
|
|
|||
|
void MachineStartDialog::on_cancel_Btn_clicked()
|
|||
|
{
|
|||
|
m_result = 0;
|
|||
|
CCommunicateAPI::getInstance()->sendRealTimeParam(YIJIAN_SHANGJI,0);
|
|||
|
this->close();
|
|||
|
}
|
|||
|
|
|||
|
int MachineStartDialog::getResult()
|
|||
|
{
|
|||
|
return m_result;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void MachineStartDialog::paintEvent(QPaintEvent *event)
|
|||
|
{
|
|||
|
Q_UNUSED(event)
|
|||
|
QPainter painter(this);
|
|||
|
painter.fillRect(rect(),QColor(0,0,0,100));
|
|||
|
}
|
|||
|
|
|||
|
void MachineStartDialog::changeEvent(QEvent* event)
|
|||
|
{
|
|||
|
switch (event->type())
|
|||
|
{
|
|||
|
case QEvent::LanguageChange:
|
|||
|
ui->retranslateUi(this);
|
|||
|
break;
|
|||
|
default:
|
|||
|
QWidget::changeEvent(event);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
void MachineStartDialog::on_confirm_Btn_pressed()
|
|||
|
{
|
|||
|
int tempCmd = 1; //1调节脚
|
|||
|
|
|||
|
|
|||
|
|
|||
|
CCommunicateAPI::getInstance()->sendRealTimeParam(YIJIAN_SHANGJI,tempCmd);
|
|||
|
// 毫秒级别,qDebug()<<QDateTime::currentTime();
|
|||
|
// 案例及时毫秒一次,按钮连续触发属性
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void MachineStartDialog::on_UpLimbOnClick_Btn_pressed()
|
|||
|
{
|
|||
|
int tempCmd = 2; //单上肢发送2,调节手
|
|||
|
CCommunicateAPI::getInstance()->sendRealTimeParam(YIJIAN_SHANGJI,tempCmd);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
void MachineStartDialog::showEvent(QShowEvent *event)
|
|||
|
{
|
|||
|
Q_UNUSED(event);
|
|||
|
|
|||
|
ui->cancel_Btn->move(170,410);
|
|||
|
ui->UpLimbOnClick_Btn->setVisible(true); //单上肢
|
|||
|
ui->UpLimbOnClick_Btn->move(350,410); //单上肢
|
|||
|
ui->confirm_Btn->setVisible(true); //单下肢
|
|||
|
ui->confirm_Btn->move(540,410); //单下肢
|
|||
|
|
|||
|
#ifdef ONLYUPLIMP
|
|||
|
|
|||
|
ui->cancel_Btn->move(210,410);
|
|||
|
ui->UpLimbOnClick_Btn->move(470,410); //单上肢
|
|||
|
ui->confirm_Btn->setVisible(false); //单下肢
|
|||
|
ui->UpLimbOnClick_Btn->setVisible(true);
|
|||
|
#endif
|
|||
|
|
|||
|
//单下肢
|
|||
|
#ifdef ONLYDOWNLIMP
|
|||
|
ui->cancel_Btn->move(210,410);
|
|||
|
ui->confirm_Btn->move(470,410); //单下肢
|
|||
|
ui->UpLimbOnClick_Btn->setVisible(false); //单上肢
|
|||
|
ui->confirm_Btn->setVisible(true); //单下肢
|
|||
|
#endif
|
|||
|
}
|
|||
|
|