diff --git a/acceleration.ui b/acceleration.ui
index 18ecbbf..816dbb4 100644
--- a/acceleration.ui
+++ b/acceleration.ui
@@ -995,31 +995,11 @@
1倍频幅值
- -
-
- 带回滞1倍频相位
-
-
- -
-
- 不带回滞1倍频相位
-
-
-
2倍频幅值
- -
-
- 带回滞2倍频相位
-
-
- -
-
- 不带回滞2倍频相位
-
-
@@ -1100,31 +1080,11 @@
1倍频幅值
- -
-
- 带回滞1倍频相位
-
-
- -
-
- 不带回滞1倍频相位
-
-
-
2倍频幅值
- -
-
- 带回滞2倍频相位
-
-
- -
-
- 不带回滞2倍频相位
-
-
diff --git a/acceleration_ds.h b/acceleration_ds.h
index df31f6a..acf9601 100644
--- a/acceleration_ds.h
+++ b/acceleration_ds.h
@@ -40,11 +40,7 @@ typedef enum {
kAccRecorderOutNone = 0,
kAccRecorderOutDirectAmpl = 1,
kAccRecorderOut1XAmpl = 2,
- kAccRecorderOut1XPhaseLagWithHysteresis = 3,
- kAccRecorderOut1XPhaseLagWithoutHysteresis = 4,
- kAccRecorderOut2XAmpl = 5,
- kAccRecorderOut2XPhaseLagWithHysteresis = 6,
- kAccRecorderOut2XPhaseLagWithoutHysteresis = 7,
+ kAccRecorderOut2XAmpl = 3,
} AccRecorderOut;
#endif // ACCELERATION_DS_H
diff --git a/config_mgr.cpp b/config_mgr.cpp
index 5607fe2..988b42d 100644
--- a/config_mgr.cpp
+++ b/config_mgr.cpp
@@ -118,8 +118,6 @@ void ConfigMgr::Save(QString & file_path) {
QJsonObject x2;
QJsonObject recorder_out;
QJsonObject delay;
- QJsonObject not1x;
- QJsonObject smax;
QJsonArray latching;
direct["full_scale_range"] = radial_ptr->direct_.full_scale_range;
direct["clamp_value"] = radial_ptr->direct_.clamp_value;
@@ -147,16 +145,6 @@ void ConfigMgr::Save(QString & file_path) {
delay["danger"] = radial_ptr->delay_.danger;
delay["active_100ms"] = radial_ptr->delay_.active_100ms;
variables["delay"] = delay;
- not1x["checked"] = radial_ptr->not1x_.checked;
- not1x["full_scale_range"] = radial_ptr->not1x_.full_scale_range;
- not1x["clamp_value"] = radial_ptr->not1x_.clamp_value;
- not1x["custom"] = radial_ptr->not1x_.custom;
- variables["not1x"] = not1x;
- smax["checked"] = radial_ptr->smax_.checked;
- smax["full_scale_range"] = radial_ptr->smax_.full_scale_range;
- smax["clamp_value"] = radial_ptr->smax_.clamp_value;
- smax["custom"] = radial_ptr->smax_.custom;
- variables["smax"] = smax;
latching.append(radial_ptr->alert_latching_);
latching.append(radial_ptr->danger_latching_);
variables["latching"] = latching;
@@ -450,16 +438,6 @@ void ConfigMgr::Load(QString filename) {
variable->delay_.alert = delay["alert"].toInt();
variable->delay_.danger = delay["danger"].toDouble();
variable->delay_.active_100ms = delay["active_100ms"].toBool();
- QJsonObject not1x = tmp_variable["not1x"].toObject();
- variable->not1x_.checked = not1x["checked"].toBool();
- variable->not1x_.full_scale_range = not1x["full_scale_range"].toInt();
- variable->not1x_.clamp_value = not1x["clamp_value"].toDouble();
- variable->not1x_.custom = not1x["custom"].toDouble();
- QJsonObject smax = tmp_variable["smax"].toObject();
- variable->smax_.checked = smax["checked"].toBool();
- variable->smax_.full_scale_range = smax["full_scale_range"].toInt();
- variable->smax_.clamp_value = smax["clamp_value"].toDouble();
- variable->smax_.custom = smax["custom"].toDouble();
QJsonObject latching = tmp_variable["latching"].toObject();
variable->alert_latching_ = latching["alert"].toBool();
variable->danger_latching_ = latching["danger"].toBool();
diff --git a/config_mgr.h b/config_mgr.h
index 2af430f..0c9e432 100644
--- a/config_mgr.h
+++ b/config_mgr.h
@@ -22,8 +22,16 @@ protected:
QMimeData *mimeData = new QMimeData;
- QString customData = item->data(Qt::UserRole).toString();
- mimeData->setData("application/x-custom", customData.toUtf8());
+ // 获取显示文本和 UserRole 数据
+ QString visibleText = item->text();
+ QString userData = item->data(Qt::UserRole).toString();
+
+ // 使用 QDataStream 打包数据
+ QByteArray data;
+ QDataStream stream(&data, QIODevice::WriteOnly);
+ stream << visibleText << userData; // 包含显示文本和 UserRole 数据
+
+ mimeData->setData("application/x-custom", data); // 设置自定义 MIME 数据
QDrag *drag = new QDrag(this);
drag->setMimeData(mimeData);
diff --git a/displacement_ds.h b/displacement_ds.h
index ff955ec..cf9d6bc 100644
--- a/displacement_ds.h
+++ b/displacement_ds.h
@@ -14,15 +14,8 @@ typedef enum {
typedef enum {
kDisRecorderOutNone = 0,
kDisRecorderOutDirectAmpl = 1,
- kDisRecorderOutGap = 2,
- kDisRecorderOut1XAmpl = 3,
- kDisRecorderOut1XPhaseLagWithHysteresis = 4,
- kDisRecorderOut1XPhaseLagWithoutHysteresis = 5,
- kDisRecorderOut2XAmpl = 6,
- kDisRecorderOut2XPhaseLagWithHysteresis = 7,
- kDisRecorderOut2XPhaseLagWithoutHysteresis = 8,
- kDisRecorderOutNot1XAmpl = 9,
- kDisRecorderOutSmaxAmpl = 10
+ kDisRecorderOut1XAmpl = 2,
+ kDisRecorderOut2XAmpl = 3
} DisRecorderOut;
#endif // DISPLACEMENT_DS_H
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 9802525..ad2ec33 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -290,8 +290,9 @@ void MainWindow::onMenuActionTriggered() {
ConfigMgr::Instance()->card_type_[button_id + 1] != kCardNone)) {
QMessageBox::information(this, QStringLiteral("提示"), "不要重叠三冗余板卡配置,请在创建新配置之前移除现有的配置!");
return;
- } else if (card_type == kCardRelayTMRPrimary && map_slot_config[button_id + 1].slot_type == "" \
- && map_slot_config[button_id + 2].slot_type == "") {
+ } else if (card_type == kCardRelayTMRPrimary && ConfigMgr::Instance()->card_type_[button_id - 1] == kCardNone \
+ && ConfigMgr::Instance()->card_type_[button_id] == kCardNone &&
+ ConfigMgr::Instance()->card_type_[button_id + 1] == kCardNone) {
map_slot_config[button_id].slot_type = slot_type;
map_slot_config[button_id].slot_btn->setText(chan_display);
map_slot_config[button_id + 1].slot_type = slot_type;
@@ -309,7 +310,7 @@ void MainWindow::onMenuActionTriggered() {
ConfigMgr::Instance()->card_type_[button_id] != kCardNone)) {
QMessageBox::information(this, QStringLiteral("提示"), "不要重叠两板卡配置,请在创建新配置之前移除现有的配置!");
return;
- } else if (rack_type == "两板卡" && ConfigMgr::Instance()->card_type_[button_id - 1] != kCardNone) {
+ } else if (rack_type == "两板卡" && ConfigMgr::Instance()->card_type_[button_id - 1] == kCardNone) {
map_slot_config[button_id].slot_type = slot_type;
map_slot_config[button_id].slot_btn->setText(chan_display);
map_slot_config[button_id + 1].slot_type = slot_type;
@@ -317,7 +318,7 @@ void MainWindow::onMenuActionTriggered() {
}
if ((card_type == kCardVibSingle || card_type == kCardSpeedSingle ||
card_type == kCardKeyphaseSingle || card_type == kCardRelaySingle ||
- card_type == kCardRelaySingleNOK) && ConfigMgr::Instance()->card_type_[button_id - 1] != kCardNone) {
+ card_type == kCardRelaySingleNOK) && ConfigMgr::Instance()->card_type_[button_id - 1] == kCardNone) {
map_slot_config[button_id].slot_type = slot_type;
button->setText(chan_display);
ConfigMgr::Instance()->card_type_[button_id - 1] = card_type;
@@ -326,7 +327,7 @@ void MainWindow::onMenuActionTriggered() {
card_type == kCardRelaySingleNOK) && ConfigMgr::Instance()->card_type_[button_id - 1] != kCardNone) {
QMessageBox::information(this, QStringLiteral("提示"), "不要重叠单板卡配置,请在创建新配置之前移除现有的配置!");
return;
- }
+ }
if (action->text() == "重置模块") {
if (ConfigMgr::Instance()->card_type_[button_id - 1] == kCardRelayTMRPrimary) {
map_slot_config[button_id].slot_type = "";
@@ -470,6 +471,8 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
QString object_name = slot_btn->objectName();
int button_id = object_name.right(object_name.length() - 15).toInt();
std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
+ if(base_ptr == nullptr)
+ return;
switch(base_ptr->card_type_){
case kCardVibSingle:{
QString object_name = slot_btn->objectName();
@@ -492,6 +495,9 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
if(slot_btn != NULL && ui->pushButton_point_name->isChecked()){
QString object_name = slot_btn->objectName();
int button_id = object_name.right(object_name.length() - 15).toInt();
+ std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(button_id);
+ if(base_ptr == nullptr)
+ return;
PointName *point_name = new PointName(button_id,ConfigMgr::Instance()->card_type_[button_id - 1]);
point_name->setWindowModality(Qt::ApplicationModal);
point_name->show();
diff --git a/radial_vibration.cpp b/radial_vibration.cpp
index 9c5a1f3..e82e43d 100644
--- a/radial_vibration.cpp
+++ b/radial_vibration.cpp
@@ -60,26 +60,6 @@ void Radial::on_checkBox_2x_ampl_toggled(bool checked) {
ui->doubleSpinBox_2x_phase_lag_clamp->setEnabled(false);
}
-void Radial::on_checkBox_not_1x_ampl_toggled(bool checked) {
- if (checked) {
- ui->comboBox_not_1x_ampl->setEnabled(true);
- ui->doubleSpinBox_not_1x_ampl_clamp->setEnabled(true);
- return;
- }
- ui->comboBox_not_1x_ampl->setEnabled(false);
- ui->doubleSpinBox_not_1x_ampl_clamp->setEnabled(false);
-}
-
-void Radial::on_checkBox_smax_ampl_toggled(bool checked) {
- if (checked) {
- ui->comboBox_smax_range->setEnabled(true);
- ui->doubleSpinBox_smax_clamp->setEnabled(true);
- return;
- }
- ui->comboBox_smax_range->setEnabled(false);
- ui->doubleSpinBox_smax_clamp->setEnabled(false);
-}
-
void Radial::Init() {
std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
if (base_ptr == nullptr) {
@@ -119,14 +99,6 @@ void Radial::Init() {
ui->comboBox_2x_value_range->setCurrentIndex(variable_ptr->x2_.full_scale_range);
ui->doubleSpinBox_2x_ampl_clamp->setValue(variable_ptr->x2_.clamp_value);
ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->x2_.phase_lag);
- ui->checkBox_not_1x_ampl->setChecked(variable_ptr->not1x_.checked);
- ui->comboBox_not_1x_ampl->setCurrentIndex(variable_ptr->not1x_.full_scale_range);
- ui->doubleSpinBox_not_1x_ampl_clamp->setValue(variable_ptr->not1x_.clamp_value);
-// ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->not1x_.custom);
- ui->checkBox_smax_ampl->setChecked(variable_ptr->smax_.checked);
- ui->comboBox_smax_range->setCurrentIndex(variable_ptr->smax_.full_scale_range);
- ui->doubleSpinBox_smax_clamp->setValue(variable_ptr->smax_.clamp_value);
-// ui->doubleSpinBox_2x_phase_lag_clamp->setValue(variable_ptr->smax_.custom);
ui->spinBox_alert->setValue(variable_ptr->delay_.alert);
ui->doubleSpinBox_danger->setValue(variable_ptr->delay_.danger);
ui->checkBox_100ms->setChecked(variable_ptr->delay_.active_100ms);
@@ -184,14 +156,6 @@ void Radial::on_pushButton_confirm_clicked() {
variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex();
variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value();
- variable->not1x_.checked = ui->checkBox_not_1x_ampl->isChecked();
- variable->not1x_.full_scale_range = ui->comboBox_not_1x_ampl->currentIndex();
- variable->not1x_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
- variable->not1x_.custom = 0; // TODO:
- variable->smax_.checked = ui->checkBox_smax_ampl->isChecked();
- variable->smax_.full_scale_range = ui->comboBox_smax_range->currentIndex();
- variable->smax_.clamp_value = ui->doubleSpinBox_smax_clamp->value();
- variable->smax_.custom = 0; // TODO:
variable->delay_.alert = ui->spinBox_alert->value();
variable->delay_.danger = ui->doubleSpinBox_danger->value();
variable->delay_.active_100ms = ui->checkBox_100ms->isChecked();
@@ -229,14 +193,6 @@ void Radial::on_pushButton_confirm_clicked() {
variable->recorder_out_.trip_multiply = ui->doubleSpinBox_trip_multiply->value();
variable->recorder_out_.comparision = ui->comboBox_comparision->currentIndex();
variable->recorder_out_.percentage = ui->spinBox_comparision_percentage->value();
- variable->not1x_.checked = ui->checkBox_not_1x_ampl->isChecked();
- variable->not1x_.full_scale_range = ui->comboBox_not_1x_ampl->currentIndex();
- variable->not1x_.clamp_value = ui->doubleSpinBox_1x_ampl_clamp->value();
- variable->not1x_.custom = 0; // TODO:
- variable->smax_.checked = ui->checkBox_smax_ampl->isChecked();
- variable->smax_.full_scale_range = ui->comboBox_smax_range->currentIndex();
- variable->smax_.clamp_value = ui->doubleSpinBox_smax_clamp->value();
- variable->smax_.custom = 0; // TODO:
variable->delay_.alert = ui->spinBox_alert->value();
variable->delay_.danger = ui->doubleSpinBox_danger->value();
variable->delay_.active_100ms = ui->checkBox_100ms->isChecked();
diff --git a/radial_vibration.ui b/radial_vibration.ui
index 84eee4e..ef84d42 100644
--- a/radial_vibration.ui
+++ b/radial_vibration.ui
@@ -678,162 +678,6 @@
-
-
-
- 20
- 240
- 91
- 16
-
-
-
- 非1倍频幅值
-
-
-
-
- false
-
-
-
- 130
- 240
- 111
- 22
-
-
-
- 4
-
- -
-
- 0-100 um
-
-
- -
-
- 0-150 um
-
-
- -
-
- 0-200 um
-
-
- -
-
- 0-400 um
-
-
- -
-
- 0-500 um
-
-
- -
-
- 自定义
-
-
-
-
-
- false
-
-
-
- 260
- 240
- 62
- 22
-
-
-
- 0
-
-
- 1000.000000000000000
-
-
-
-
- false
-
-
-
- 130
- 270
- 111
- 22
-
-
-
- 4
-
- -
-
- 0-100 um
-
-
- -
-
- 0-150 um
-
-
- -
-
- 0-200 um
-
-
- -
-
- 0-400 um
-
-
- -
-
- 0-500 um
-
-
- -
-
- 自定义
-
-
-
-
-
-
- 20
- 270
- 91
- 16
-
-
-
- Smax 幅值
-
-
-
-
- false
-
-
-
- 260
- 270
- 62
- 22
-
-
-
- 0
-
-
- 1000.000000000000000
-
-
@@ -1042,51 +886,16 @@
直接幅值
- -
-
- 间隙
-
-
-
1倍频幅值
- -
-
- 带回滞1倍频相位
-
-
- -
-
- 不带回滞1倍频相位
-
-
-
2倍频幅值
- -
-
- 带回滞2倍频相位
-
-
- -
-
- 不带回滞2倍频相位
-
-
- -
-
- 非1倍频幅值
-
-
- -
-
- Smax幅值
-
-
@@ -1152,51 +961,16 @@
直接幅值
- -
-
- 间隙
-
-
-
1倍频幅值
- -
-
- 带回滞1倍频相位
-
-
- -
-
- 不带回滞1倍频相位
-
-
-
2倍频幅值
- -
-
- 带回滞2倍频相位
-
-
- -
-
- 不带回滞2倍频相位
-
-
- -
-
- 非1倍频幅值
-
-
- -
-
- Smax幅值
-
-
diff --git a/singlerelay.cpp b/singlerelay.cpp
index ac823e0..6ec8da8 100644
--- a/singlerelay.cpp
+++ b/singlerelay.cpp
@@ -12,10 +12,12 @@ SingleRelay::SingleRelay(int slot,int cardtype,QWidget *parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QVBoxLayout *layout_relay = new QVBoxLayout(ui->widget_relay);
textEdit_relay = new DropTextEdit;
+ textEdit_relay->setAcceptDrops(true);
layout_relay->addWidget(textEdit_relay);
QVBoxLayout *layout_available = new QVBoxLayout(ui->widget_available);
- list_widget_available = new DraggableListWidget;
+ list_widget_available = new DraggableListWidget();
layout_available->addWidget(list_widget_available);
+ list_widget_available->setDragEnabled(true);
btnGroup_slot = new QButtonGroup(this);
btnGroup_slot->addButton(ui->pushButton_slot1);
@@ -36,13 +38,15 @@ SingleRelay::SingleRelay(int slot,int cardtype,QWidget *parent)
btnGroup_slot->addButton(ui->pushButton_slot16);
connect(btnGroup_slot, SIGNAL(buttonClicked(QAbstractButton *)), this, SLOT(OnButtonGroup(QAbstractButton *)));
- connect(ui->pushButton_backspace, &QPushButton::clicked, textEdit_relay, &DropTextEdit::removeLastElement);
+ //connect(ui->pushButton_backspace, &QPushButton::clicked, textEdit_relay, &DropTextEdit::removeLastElement);
connect(ui->comboBox_relay_ch, QOverload::of(&QComboBox::currentIndexChanged),
this, &SingleRelay::onComboBoxIndexChanged);
Init();
current_index = ui->comboBox_relay_ch->currentIndex();
- if(single_relay_nok_data->single_relay_nok[current_index].logic_expression != "")
- textEdit_relay->setPlainText(single_relay_nok_data->single_relay_nok[current_index].logic_expression);
+ if(single_relay_nok_data->single_relay_nok[current_index].logic_expression != ""){
+ QString channel_name = channelNameMap[single_relay_nok_data->single_relay_nok[current_index].logic_expression];
+ textEdit_relay->setPlainText(channel_name);
+ }
}
SingleRelay::~SingleRelay() {
@@ -88,7 +92,22 @@ void SingleRelay::Init(){
return;
}
single_relay_nok_data = std::dynamic_pointer_cast(base_ptr);
+ for(int i = 0 ; i < SLOT_NUM ; i++){
+ std::shared_ptr cardbase_ptr = ConfigMgr::Instance()->GetSlotPtr(i + 1);
+ if(cardbase_ptr != nullptr &&
+ cardbase_ptr->card_type_ == kCardVibSingle){
+ std::shared_ptr ptr = std::dynamic_pointer_cast(cardbase_ptr);
+ for (int var = 0; var < CHANNEL_COUNT; ++var) {
+ QString item_data,item_str;
+ item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(ptr->base_config_[var].point_name).arg(ptr->base_config_[var].chan_id.mid(1,2)).arg(ptr->base_config_[var].chan_id.mid(4,2));
+ item_data = QString("%1P##NO").arg(ptr->base_config_[var].chan_id);
+ channelNameMap[item_data] = item_str;
+ }
+ }else if(cardbase_ptr != nullptr &&
+ cardbase_ptr->card_type_ == kCardSpeedSingle){
+ }
+ }
}
void SingleRelay::on_pushButton_cancel_clicked() {
this->close();
@@ -105,7 +124,7 @@ void SingleRelay::OnButtonGroup(QAbstractButton *slot_btn) {
std::shared_ptr vib_data = std::dynamic_pointer_cast(base_ptr);
if((vib_data->base_config_[var].standby && vib_data->base_config_[var + 1].standby && !(var % 2)))
continue;
- QString item_str = QString("%1 (Slot %2 Channel %3 Not OK)").arg(vib_data->base_config_[var].point_name).arg(button_id).arg(var+1);
+ QString item_str = QString("%1 (槽位 %2 通道 %3 非OK)").arg(vib_data->base_config_[var].point_name).arg(button_id).arg(var+1);
QListWidgetItem *item = new QListWidgetItem(item_str);
QString item_data = QString("S%1C%2P##NO").arg(QString::number(button_id, 10).rightJustified(2, '0')).arg(QString::number(var+1, 10).rightJustified(2, '0'));
item->setData(Qt::UserRole, item_data);
@@ -147,7 +166,19 @@ void SingleRelay::on_pushButton_confirm_clicked()
void SingleRelay::onComboBoxIndexChanged(int index){
qDebug()<< "[SingleRelay]:index " << index;
- single_relay_nok_data->single_relay_nok[current_index].logic_expression = textEdit_relay->toPlainText();
+ QString html = textEdit_relay->toHtml();
+ qDebug() << html ;
+ QRegularExpression spanRegex(R"(]*data-key='([^']+)'[^>]*>([^<]+))");
+ QRegularExpressionMatchIterator i = spanRegex.globalMatch(html);
+ QString userData = "",visibleText = "";
+ while (i.hasNext()) {
+ QRegularExpressionMatch match = i.next();
+ userData = match.captured(1);
+ visibleText = match.captured(2);
+ }
+ qDebug() << "Extracted data-key:" << userData << ", text:" << visibleText;
+
+ single_relay_nok_data->single_relay_nok[current_index].logic_expression = userData;
current_index = index;
textEdit_relay->setPlainText(single_relay_nok_data->single_relay_nok[index].logic_expression);
}
diff --git a/singlerelay.h b/singlerelay.h
index 3795149..7659aac 100644
--- a/singlerelay.h
+++ b/singlerelay.h
@@ -20,52 +20,7 @@ public:
setAcceptDrops(true);
}
public slots:
- void removeLastElement() {
- QString html = this->toHtml();
- // 匹配 元素
- QRegularExpression spanRe(R"(]*>[^<]*)");
- QRegularExpressionMatchIterator spanIt = spanRe.globalMatch(html);
-
- // 匹配符号元素(注意符号两边可能有空格)
- QRegularExpression symbolRe(R"((\s?[+*()]\s?))");
- QRegularExpressionMatchIterator symbolIt = symbolRe.globalMatch(html);
-
- // 保存所有匹配结果:位置 + 匹配内容
- struct Match {
- int start;
- int length;
- };
- QList matches;
-
- while (spanIt.hasNext()) {
- auto m = spanIt.next();
- matches.append({ m.capturedStart(), m.capturedLength() });
- }
-
- while (symbolIt.hasNext()) {
- auto m = symbolIt.next();
- matches.append({ m.capturedStart(), m.capturedLength() });
- }
-
- if (matches.isEmpty())
- return;
-
- // 找出最后出现的元素
- std::sort(matches.begin(), matches.end(), [](const Match &a, const Match &b) {
- return a.start < b.start;
- });
-
- // 删除最后一个匹配
- Match last = matches.last();
- html.remove(last.start, last.length);
- this->setHtml(html);
-
- // 保持光标在末尾
- QTextCursor cursor = this->textCursor();
- cursor.movePosition(QTextCursor::End);
- this->setTextCursor(cursor);
- }
protected:
void dragEnterEvent(QDragEnterEvent *event) override {
if (event->mimeData()->hasFormat("application/x-custom")) {
@@ -90,22 +45,17 @@ protected:
}
if (event->mimeData()->hasFormat("application/x-custom")) {
QByteArray data = event->mimeData()->data("application/x-custom");
+ QDataStream stream(&data, QIODevice::ReadOnly);
+ QString visibleText, userData;
+ stream >> visibleText >> userData; // 解析显示文本和 UserRole 数据
+ qDebug() << visibleText << userData;
QString text = QString::fromUtf8(data);
QTextCursor cursor = this->textCursor();
this->setTextCursor(cursor);
- QString html = QString(
- "%1"
- ).arg(text);
+ QString html = QString("%2 ")
+ .arg(userData.toHtmlEscaped(), visibleText.toHtmlEscaped());
cursor.insertHtml(html);
event->acceptProposedAction();
} else {
@@ -143,6 +93,8 @@ private:
DropTextEdit *textEdit_relay = nullptr;
std::shared_ptr single_relay_nok_data = nullptr;
int current_index;
+ QMap channelNameMap;
+
void Init();
};
diff --git a/tmrrelayassociation.cpp b/tmrrelayassociation.cpp
index 16cac0d..a54612b 100644
--- a/tmrrelayassociation.cpp
+++ b/tmrrelayassociation.cpp
@@ -139,7 +139,7 @@ void TMRRelayAssociation::Init(){
channelNameMap[item_data] = item_str;
}
}else if(cardbase_ptr != nullptr &&
- (cardbase_ptr->card_type_ == kCardSpeedSingle)){
+ cardbase_ptr->card_type_ == kCardSpeedSingle){
}
}
@@ -148,6 +148,7 @@ void TMRRelayAssociation::Init(){
setExpressionToTreeView(treeView_relay, relay_data->tmr_relay[current_index].logic_expression);
}
}
+
ExprNode* TMRRelayAssociation::parseExpression(const QString& expr, int& pos) {
auto skipSpaces = [&]() {
while (pos < expr.length() && expr[pos].isSpace()) pos++;
@@ -375,7 +376,6 @@ ExprValidationResult TMRRelayAssociation::validateLogicExpression(const QString&
}
void TMRRelayAssociation::buildTreeFromExpression(QTreeView *treeView, const QString &expr) {
- QStandardItemModel* model = new QStandardItemModel();
QStandardItem* rootItem = parseExpression(expr);
if (rootItem) {
@@ -404,6 +404,8 @@ void TMRRelayAssociation::OnButtonGroup(QAbstractButton *slot_btn) {
list_widget_available->addItem(item_or);
for(int var = 0; var < CHANNEL_COUNT ; ++var){
QString item_data;
+ if(ptr->base_config_[var].standby && ptr->base_config_[var + 1].standby && (var % 2))
+ continue;
if(ptr->alert_danger[var].direct_enable ||
ptr->alert_danger[var].x1_ampl_enable ||
ptr->alert_danger[var].x2_ampl_enable){
diff --git a/tmrrelayassociation.h b/tmrrelayassociation.h
index 3986a66..d0b5ffc 100644
--- a/tmrrelayassociation.h
+++ b/tmrrelayassociation.h
@@ -9,6 +9,7 @@
#include //数据模型类
#include
#include "tmrrelayassociation_data.h"
+#include
namespace Ui {
class TMRRelayAssociation;
diff --git a/tmrrelayassociation.ui b/tmrrelayassociation.ui
index 9192415..7698544 100644
--- a/tmrrelayassociation.ui
+++ b/tmrrelayassociation.ui
@@ -973,7 +973,7 @@
130
20
54
- 12
+ 21
@@ -996,7 +996,7 @@
610
80
251
- 421
+ 441
diff --git a/velocity.ui b/velocity.ui
index d8fb3d3..4783dd6 100644
--- a/velocity.ui
+++ b/velocity.ui
@@ -859,31 +859,11 @@
1倍频幅值
- -
-
- 带回滞1倍频相位
-
-
- -
-
- 不带回滞1倍频相位
-
-
-
2倍频幅值
- -
-
- 带回滞2倍频相位
-
-
- -
-
- 不带回滞2倍频相位
-
-
@@ -954,31 +934,11 @@
1倍频幅值
- -
-
- 带回滞1倍频相位
-
-
- -
-
- 不带回滞1倍频相位
-
-
-
2倍频幅值
- -
-
- 带回滞2倍频相位
-
-
- -
-
- 不带回滞2倍频相位
-
-
diff --git a/velocity_ds.h b/velocity_ds.h
index b090a65..d9dcc91 100644
--- a/velocity_ds.h
+++ b/velocity_ds.h
@@ -30,11 +30,7 @@ typedef enum {
kVelRecorderOutNone = 0,
kVelRecorderOutDirectAmpl = 1,
kVelRecorderOut1XAmpl = 2,
- kVelRecorderOut1XPhaseLagWithHysteresis = 3,
- kVelRecorderOut1XPhaseLagWithoutHysteresis = 4,
- kVelRecorderOut2XAmpl = 5,
- kVelRecorderOut2XPhaseLagWithHysteresis = 6,
- kVelRecorderOut2XPhaseLagWithoutHysteresis = 7,
+ kVelRecorderOut2XAmpl = 3
} VelRecorderOut;
#endif // VELOCITY_DS_H