优化界面
This commit is contained in:
parent
4b28af5a4e
commit
8f75f5672c
@ -70,6 +70,11 @@ enum CMTCommand {
|
||||
kConfigSubCard = 16, // 请求无包体,响应有包体
|
||||
kRS485BaudrateSet = 17, // RS485波特率配置
|
||||
kRS485BaudrateGet = 18, // RS485波特率获取
|
||||
kConfigIPv4 = 19, // 配置IP地址
|
||||
kConfigMac = 20, // 配置Mac地址
|
||||
kRebootCard = 21, // 重启板卡
|
||||
kGetCardDcValue = 22, // 获取子板平均值
|
||||
kGetRelayStatus = 23, // 获取继电器状态
|
||||
};
|
||||
enum RS485Baudrate {
|
||||
kBaudrate2400 = 0,
|
||||
@ -320,7 +325,48 @@ typedef struct {
|
||||
typedef struct {
|
||||
uint8_t code; // 0: success
|
||||
} BaudrateSetRsp;
|
||||
// cmd: kConfigIPv4
|
||||
typedef struct {
|
||||
uint8_t ethn; // 0: eth0, 1: eth1
|
||||
char ip[16];
|
||||
char netmask[16];
|
||||
} ConfigIPv4Req;
|
||||
|
||||
// 配置IP的响应结构为CommonRsp
|
||||
|
||||
// cmd: kConfigMac
|
||||
typedef struct {
|
||||
uint8_t ethn; // 0: eth0, 1: eth1
|
||||
char mac[18];
|
||||
} ConfigMacReq;
|
||||
|
||||
// 配置MAC的响应结构为CommonRsp
|
||||
|
||||
// cmd: kRebootCard
|
||||
typedef struct {
|
||||
uint8_t card_id; // 0: cpu板卡, 1~15对应相应槽位
|
||||
} RebootCardReq;
|
||||
|
||||
// 此命令无响应,可观察各板卡灯的变化情况
|
||||
|
||||
// cmd: kGetCardDcValue
|
||||
typedef struct {
|
||||
uint8_t card_id; // 1 ~ 15
|
||||
} GetCardDcValueReq;
|
||||
|
||||
typedef struct {
|
||||
float dc_value[4];
|
||||
} GetCardDcValueRsp;
|
||||
|
||||
// cmd: kGetRelayStatus
|
||||
typedef struct {
|
||||
uint8_t card_id;
|
||||
} GetRelayStatusReq;
|
||||
|
||||
typedef struct {
|
||||
uint8_t card_id;
|
||||
uint16_t status; // 0: 正常 1:开出, 从低位到高位分别为继电器的通道1 ~ 16
|
||||
} GetRelayStatusRsp;
|
||||
#pragma pack()
|
||||
|
||||
#endif // DATA_CONFIG_H
|
||||
|
12
setpoint.ui
12
setpoint.ui
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
<string>触发配置</string>
|
||||
</property>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
@ -50,16 +50,6 @@
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboBox_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>30</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
|
@ -6,6 +6,10 @@ SingleRelay::SingleRelay(QWidget *parent)
|
||||
, ui(new Ui::SingleRelay) {
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
QVBoxLayout *layout = new QVBoxLayout(ui->widget_relay);
|
||||
DropTextEdit *textEdit = new DropTextEdit;
|
||||
|
||||
layout->addWidget(textEdit);
|
||||
}
|
||||
|
||||
SingleRelay::~SingleRelay() {
|
||||
|
@ -2,6 +2,11 @@
|
||||
#define SINGLERELAY_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextEdit>
|
||||
#include <QMimeData>
|
||||
#include <QDrag>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Ui {
|
||||
class SingleRelay;
|
||||
@ -20,5 +25,38 @@ class SingleRelay : public QDialog {
|
||||
private:
|
||||
Ui::SingleRelay *ui;
|
||||
};
|
||||
class DropTextEdit : public QTextEdit {
|
||||
public:
|
||||
DropTextEdit(QWidget *parent = nullptr) : QTextEdit(parent) {
|
||||
setAcceptDrops(true);
|
||||
setReadOnly(false); // 确保不是只读的
|
||||
}
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override {
|
||||
qDebug() << "dragEnterEvent" << event->mimeData()->formats();
|
||||
if (event->mimeData()->hasText()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void dragMoveEvent(QDragMoveEvent *event) override {
|
||||
if (event->mimeData()->hasText()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void dropEvent(QDropEvent *event) override {
|
||||
if (event->mimeData()->hasText()) {
|
||||
insertPlainText(event->mimeData()->text());
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif // SINGLERELAY_H
|
||||
|
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>继电器组态</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
@ -65,23 +65,6 @@
|
||||
<string>或(*)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>380</y>
|
||||
<width>551</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'.AppleSystemUIFont'; font-size:13pt;">S02C01P##NO</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -111,7 +94,7 @@ p, li { white-space: pre-wrap; }
|
||||
<string>打 印...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<widget class="QListWidget" name="listWidget_available">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
@ -120,6 +103,12 @@ p, li { white-space: pre-wrap; }
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="dragDropMode">
|
||||
<enum>QAbstractItemView::DragOnly</enum>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S02C01P##NO (Slot 2 Channel 1 Not OK)</string>
|
||||
@ -1096,6 +1085,16 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_relay" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>380</y>
|
||||
<width>561</width>
|
||||
<height>131</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user