11/25
This commit is contained in:
86
ZBD_IIIDL_S_Project/Src/CustomWidget/bleitem.cpp
Normal file
86
ZBD_IIIDL_S_Project/Src/CustomWidget/bleitem.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
#include "bleitem.h"
|
||||
#include "ui_bleitem.h"
|
||||
#include <QPixmap>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
|
||||
BLEItem::BLEItem(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::BLEItem)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
BLEItem::BLEItem(uint8_t device):ui(new Ui::BLEItem)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
deviceNum = device;
|
||||
}
|
||||
|
||||
BLEItem::~BLEItem()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BLEItem::setBLEName(uint8_t name)
|
||||
{
|
||||
deviceNum = name;
|
||||
QString nameStr;
|
||||
switch(name)
|
||||
{
|
||||
case 1:
|
||||
nameStr = "A";
|
||||
break;
|
||||
case 2:
|
||||
nameStr = "B";
|
||||
break;
|
||||
case 3:
|
||||
nameStr = "C";
|
||||
break;
|
||||
case 4:
|
||||
nameStr = "D";
|
||||
break;
|
||||
}
|
||||
ui->BLEName_Label->setText(tr("电刺激盒%1").arg(nameStr));
|
||||
}
|
||||
|
||||
uint8_t BLEItem::getBLEName()
|
||||
{
|
||||
return deviceNum;
|
||||
}
|
||||
|
||||
void BLEItem::setBLEBattery(uint8_t battery)
|
||||
{
|
||||
QString batteryImg = QString("qrc:/DependFile/Source/Fes/battery_%1.png").arg(battery);
|
||||
ui->BLEBattery_Label->setPixmap(QPixmap(batteryImg));
|
||||
}
|
||||
|
||||
void BLEItem::setDeviceState(bool state)
|
||||
{
|
||||
if(state)
|
||||
{
|
||||
ui->connectBLE_Btn->setText(tr("断开"));
|
||||
}
|
||||
else
|
||||
ui->connectBLE_Btn->setText(tr("连接"));
|
||||
emit signalBtnStateChanged(deviceNum,state);
|
||||
qDebug() <<"数量和状态:"<< deviceNum << state ;
|
||||
}
|
||||
|
||||
void BLEItem::on_connectBLE_Btn_clicked()
|
||||
{
|
||||
if(ui->connectBLE_Btn->text() == tr("连接"))
|
||||
{
|
||||
qDebug()<<"点击连接";
|
||||
emit signalConnectDevice(true,deviceNum);
|
||||
// ui->connectBLE_Btn->setText(tr("断开"));
|
||||
}
|
||||
else if(ui->connectBLE_Btn->text() == tr("断开"))
|
||||
{
|
||||
emit signalConnectDevice(false,deviceNum);
|
||||
// ui->connectBLE_Btn->setText(tr("连接"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
36
ZBD_IIIDL_S_Project/Src/CustomWidget/bleitem.h
Normal file
36
ZBD_IIIDL_S_Project/Src/CustomWidget/bleitem.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef BLEITEM_H
|
||||
#define BLEITEM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class BLEItem;
|
||||
}
|
||||
|
||||
class BLEItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BLEItem(QWidget *parent = nullptr);
|
||||
BLEItem(uint8_t device);
|
||||
~BLEItem();
|
||||
//设置蓝牙名称
|
||||
void setBLEName(uint8_t name);
|
||||
uint8_t getBLEName();
|
||||
//设置电量
|
||||
void setBLEBattery(uint8_t battery);
|
||||
//设置设备状态
|
||||
void setDeviceState(bool);
|
||||
private slots:
|
||||
void on_connectBLE_Btn_clicked();
|
||||
|
||||
signals:
|
||||
void signalConnectDevice(bool connect,uint8_t device);
|
||||
void signalBtnStateChanged(uint8_t deviceNo,bool state);
|
||||
private:
|
||||
Ui::BLEItem *ui;
|
||||
uint8_t deviceNum;
|
||||
};
|
||||
|
||||
#endif // BLEITEM_H
|
||||
201
ZBD_IIIDL_S_Project/Src/CustomWidget/bleitem.ui
Normal file
201
ZBD_IIIDL_S_Project/Src/CustomWidget/bleitem.ui
Normal file
@@ -0,0 +1,201 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BLEItem</class>
|
||||
<widget class="QWidget" name="BLEItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>659</width>
|
||||
<height>78</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#groupBox{background: #E4F4FC;border:none;}</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border-image: url(:/DependFile/Source/Fes/box.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="BLEName_Label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="connectState_Label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="BLEBattery_Label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>157</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="connectBLE_Btn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton{background: #FFFFFF;border-radius: 4px;border: 1px solid #0D9DDB;}
|
||||
QPushButton:pressed{background: #05A6EC;border-radius: 4px;border: 1px solid #0D9DDB;color:#FFFFFF;}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>连接</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>19</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
57
ZBD_IIIDL_S_Project/Src/CustomWidget/fesparambtn.cpp
Normal file
57
ZBD_IIIDL_S_Project/Src/CustomWidget/fesparambtn.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "fesparambtn.h"
|
||||
#include "ui_fesparambtn.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
FesParamBtn::FesParamBtn(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::FesParamBtn)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
FesParamBtn::~FesParamBtn()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void FesParamBtn::initButton(QString title,QString unit)
|
||||
{
|
||||
ui->title_Label->setText(title);
|
||||
ui->unit_Label->setText(unit);
|
||||
// qDebug()<<"初始化按钮:"<<title <<unit;
|
||||
}
|
||||
|
||||
void FesParamBtn::setTitle(QString title)
|
||||
{
|
||||
ui->title_Label->setText(title);
|
||||
}
|
||||
|
||||
void FesParamBtn::setData(int data)
|
||||
{
|
||||
ui->data_Label->setText(QString::number(data));
|
||||
}
|
||||
|
||||
void FesParamBtn::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
emit fesButtonClicked();
|
||||
}
|
||||
|
||||
int FesParamBtn::getValue()
|
||||
{
|
||||
m_value = ui->data_Label->text().toInt();
|
||||
return m_value;
|
||||
}
|
||||
|
||||
void FesParamBtn::changeEvent(QEvent* event)
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::LanguageChange:
|
||||
;//ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
QWidget::changeEvent(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
38
ZBD_IIIDL_S_Project/Src/CustomWidget/fesparambtn.h
Normal file
38
ZBD_IIIDL_S_Project/Src/CustomWidget/fesparambtn.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef FESPARAMBTN_H
|
||||
#define FESPARAMBTN_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class FesParamBtn;
|
||||
}
|
||||
|
||||
class FesParamBtn : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FesParamBtn(QWidget *parent = nullptr);
|
||||
~FesParamBtn();
|
||||
|
||||
void initButton(QString title,QString unit);
|
||||
|
||||
void setTitle(QString title);
|
||||
|
||||
void setData(int data);
|
||||
|
||||
int getValue();
|
||||
|
||||
signals:
|
||||
void fesButtonClicked();
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
virtual void changeEvent(QEvent* event);
|
||||
private:
|
||||
Ui::FesParamBtn *ui;
|
||||
|
||||
int m_value;
|
||||
};
|
||||
|
||||
#endif // FESPARAMBTN_H
|
||||
107
ZBD_IIIDL_S_Project/Src/CustomWidget/fesparambtn.ui
Normal file
107
ZBD_IIIDL_S_Project/Src/CustomWidget/fesparambtn.ui
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FesParamBtn</class>
|
||||
<widget class="QWidget" name="FesParamBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>250</width>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="title_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>23</y>
|
||||
<width>181</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>18</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="data_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>90</y>
|
||||
<width>81</width>
|
||||
<height>70</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>30</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>5</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="unit_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>120</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>250</width>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#groupBox{background: #E4F4FC;
|
||||
border-radius: 6px;}</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>groupBox</zorder>
|
||||
<zorder>title_Label</zorder>
|
||||
<zorder>data_Label</zorder>
|
||||
<zorder>unit_Label</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
155
ZBD_IIIDL_S_Project/Src/CustomWidget/musclebutton.cpp
Normal file
155
ZBD_IIIDL_S_Project/Src/CustomWidget/musclebutton.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
#include "musclebutton.h"
|
||||
#include "ui_musclebutton.h"
|
||||
#include <QDebug>
|
||||
#include <QMouseEvent>
|
||||
#include <QPaintEvent>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QPixmap>
|
||||
|
||||
MuscleButton::MuscleButton(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::MuscleButton),
|
||||
isConnected(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// QGraphicsDropShadowEffect * shadowEffect = new QGraphicsDropShadowEffect();
|
||||
// shadowEffect->setYOffset(2);
|
||||
// shadowEffect->setBlurRadius(12);
|
||||
// shadowEffect->setColor(QColor(0,0,0,51));
|
||||
// this->setGraphicsEffect(shadowEffect);
|
||||
st_muscleParam.muscleId = 0;
|
||||
}
|
||||
|
||||
MuscleButton::~MuscleButton()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MuscleButton::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
void MuscleButton::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
emit muscleButtonClicked(m_id);
|
||||
}
|
||||
|
||||
void MuscleButton::setMuscleParamButton(const ST_MuscleParam& param)
|
||||
{
|
||||
//左右肌肉图标
|
||||
QString limpFlag;
|
||||
if(param.muscleId > 30)
|
||||
{
|
||||
limpFlag= "";
|
||||
}
|
||||
else if(param.muscleId <= 15)
|
||||
limpFlag = ":/DependFile/Source/channel/left.png";
|
||||
else
|
||||
limpFlag = ":/DependFile/Source/channel/right.png";
|
||||
QPixmap pixmap;
|
||||
pixmap.load(limpFlag);
|
||||
ui->Image_Label->setPixmap(pixmap);
|
||||
ui->muscle_Label->setText(param.muscleName );
|
||||
ui->current_Label->setText(QString::number(param.minCurrent)+"~"+QString::number(param.maxCurrent) + "mA");
|
||||
ui->plus_Label->setText(QString::number(param.plus) + "us");
|
||||
ui->frequency_Label->setText(QString::number(param.frequency) + "Hz");
|
||||
|
||||
st_muscleParam = param;
|
||||
}
|
||||
|
||||
void MuscleButton::setBLEBattery(uint8_t battery)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
QString img;
|
||||
//qDebug() <<"电量:"<<battery;
|
||||
//battery = 50;
|
||||
if(battery <= 0)
|
||||
img = ":/DependFile/Source/Fes/battery_0.png";
|
||||
else if(0 < battery && battery < 25)
|
||||
img = ":/DependFile/Source/Fes/battery_25.png";
|
||||
else if(25 <= battery && battery < 50)
|
||||
img = ":/DependFile/Source/Fes/battery_50.png";
|
||||
else if(50 <= battery && battery < 75)
|
||||
img = ":/DependFile/Source/Fes/battery_75.png";
|
||||
else if(75<= battery && battery <= 100)
|
||||
img = ":/DependFile/Source/Fes/battery_100.png";
|
||||
pixmap.load(img);
|
||||
ui->BLEBattery_Label->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void MuscleButton::initWidget(QString title,int id)
|
||||
{
|
||||
ui->channel_Label->setText(title);
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void MuscleButton::setMuscleEnabled(bool enabled)
|
||||
{
|
||||
isConnected = enabled;
|
||||
QString enabledStyle = "#groupBox{background: #E4F4FC;"
|
||||
"border-radius: 6px;}";
|
||||
QString disenabledStyle = "#groupBox{background: #EFEFEF;border-radius: 6px;}";
|
||||
if(enabled)
|
||||
ui->groupBox->setStyleSheet(enabledStyle);
|
||||
else
|
||||
ui->groupBox->setStyleSheet(disenabledStyle);
|
||||
}
|
||||
|
||||
ST_MuscleParam MuscleButton::getMuscleParam()
|
||||
{
|
||||
ST_MuscleParam st_tmpMuscleParam;
|
||||
st_tmpMuscleParam.frequency = ui->frequency_Label->text().remove("Hz").toInt();
|
||||
st_tmpMuscleParam.plus = ui->plus_Label->text().remove("us").toInt();
|
||||
QStringList currentList= ui->current_Label->text().remove("mA").split("~");
|
||||
st_tmpMuscleParam.connectState = isConnected;
|
||||
if(currentList.count() >1)
|
||||
{
|
||||
st_tmpMuscleParam.minCurrent = currentList.first().toInt();
|
||||
st_tmpMuscleParam.maxCurrent = currentList.last().toInt();
|
||||
}
|
||||
st_tmpMuscleParam.muscleName = ui->muscle_Label->text();
|
||||
st_tmpMuscleParam.muscleId = st_muscleParam.muscleId;
|
||||
return st_tmpMuscleParam;
|
||||
}
|
||||
|
||||
void MuscleButton::setConnectState(bool state)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
QString img;
|
||||
if(state)
|
||||
img = ":/DependFile/Source/channel/connected.png";
|
||||
else
|
||||
img = ":/DependFile/Source/channel/disconnected.png";
|
||||
pixmap.load(img);
|
||||
ui->connectState_Label->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void MuscleButton::setCheckedFesType(E_FES_PAGE E_fesType)
|
||||
{
|
||||
if(E_fesType == ONLY_FES_E)
|
||||
{
|
||||
ui->muscle_Label->setVisible(false);
|
||||
ui->Image_Label->setVisible(false);
|
||||
}
|
||||
else if(E_fesType == BICYCLE_FES_E)
|
||||
{
|
||||
ui->muscle_Label->setVisible(true);
|
||||
ui->Image_Label->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MuscleButton::changeEvent(QEvent* event)
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
QWidget::changeEvent(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
47
ZBD_IIIDL_S_Project/Src/CustomWidget/musclebutton.h
Normal file
47
ZBD_IIIDL_S_Project/Src/CustomWidget/musclebutton.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef MUSCLEBUTTON_H
|
||||
#define MUSCLEBUTTON_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "dataformate.h"
|
||||
namespace Ui {
|
||||
class MuscleButton;
|
||||
}
|
||||
|
||||
class MuscleButton : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MuscleButton(QWidget *parent = nullptr);
|
||||
~MuscleButton();
|
||||
|
||||
void setMuscleParamButton(const ST_MuscleParam&);
|
||||
|
||||
void setBLEBattery(uint8_t battery); //设置电池
|
||||
|
||||
void initWidget(QString title,int id);
|
||||
|
||||
void setMuscleEnabled(bool);
|
||||
|
||||
ST_MuscleParam getMuscleParam();
|
||||
|
||||
void setConnectState(bool);
|
||||
|
||||
void setCheckedFesType(E_FES_PAGE E_fesType); //根据Fes类型,是否显示肌肉、部位
|
||||
signals:
|
||||
void muscleButtonClicked(int id);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event);
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
virtual void changeEvent(QEvent* event);
|
||||
private:
|
||||
Ui::MuscleButton *ui;
|
||||
int m_id;
|
||||
ST_MuscleParam st_muscleParam;
|
||||
bool isConnected;
|
||||
};
|
||||
|
||||
#endif // MUSCLEBUTTON_H
|
||||
314
ZBD_IIIDL_S_Project/Src/CustomWidget/musclebutton.ui
Normal file
314
ZBD_IIIDL_S_Project/Src/CustomWidget/musclebutton.ui
Normal file
@@ -0,0 +1,314 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MuscleButton</class>
|
||||
<widget class="QWidget" name="MuscleButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>425</width>
|
||||
<height>225</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>130</x>
|
||||
<y>170</y>
|
||||
<width>2</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #0D9DDB;</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>170</y>
|
||||
<width>2</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #0D9DDB;</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>425</width>
|
||||
<height>225</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#groupBox{background: #E4F4FC;
|
||||
border-radius: 6px;}</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QLabel" name="current_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>254</x>
|
||||
<y>130</y>
|
||||
<width>161</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0~0mA</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>8</x>
|
||||
<y>160</y>
|
||||
<width>121</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>频率</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="frequency_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>130</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>10Hz</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="muscle_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>221</x>
|
||||
<y>26</y>
|
||||
<width>131</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>160</y>
|
||||
<width>101</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>脉宽</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="channel_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>42</x>
|
||||
<y>29</y>
|
||||
<width>71</width>
|
||||
<height>60</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>23</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>160</y>
|
||||
<width>111</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>电流</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="plus_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>138</x>
|
||||
<y>130</y>
|
||||
<width>111</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>200us</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="Image_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>50</y>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="connectState_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>122</x>
|
||||
<y>47</y>
|
||||
<width>28</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="BLEBattery_Label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>189</x>
|
||||
<y>45</y>
|
||||
<width>16</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<zorder>groupBox</zorder>
|
||||
<zorder>line</zorder>
|
||||
<zorder>line_2</zorder>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user