Преглед изворни кода

dev: firing stage confirmation when has error dets

Yao пре 1 месец
родитељ
комит
6ec5302d7c
1 измењених фајлова са 15 додато и 6 уклоњено
  1. 15 6
      fireWidget/firingwidget.cpp

+ 15 - 6
fireWidget/firingwidget.cpp

@@ -239,16 +239,25 @@ void firingWidget::handleProjectFiringMqttMessage(const QByteArray &message, con
                         case FiringStages::QuickTestFinished:
                             // 组网测试检查报错雷管数量,如果有错误,提示用户确认是否继续
                             if (relayInfo["errorCount"].toInt() > 0) {
-                                QMessageBox::StandardButton reply;
-                                reply = QMessageBox::question(nullptr, "组网测试错误",
-                                                              QString("组网测试发现 %1 个报错雷管,是否继续起爆?")
-                                                                  .arg(relayInfo["errorCount"].toInt()),
-                                                              QMessageBox::Yes | QMessageBox::No);
-                                if (reply == QMessageBox::No) {
+                                QMessageBox msgBox;
+                                msgBox.setWindowTitle("组网测试错误");
+                                msgBox.setText(QString("组网测试发现 %1 个报错雷管,是否继续起爆?")
+                                                   .arg(relayInfo["errorCount"].toInt()));
+                                QPushButton *yesButton = msgBox.addButton("确定继续", QMessageBox::YesRole);
+                                QPushButton *noButton = msgBox.addButton("取消", QMessageBox::NoRole);
+                                yesButton->setStyleSheet(
+                                    "QPushButton { background-color:rgb(5, 58, 156); color: white; padding: 5px 15px; "
+                                    "border-radius: 4px; }");
+                                noButton->setStyleSheet(
+                                    "QPushButton { background-color: #f44336; color: white; padding: 5px 15px; "
+                                    "border-radius: 4px; }");
+                                msgBox.exec();
+                                if (msgBox.clickedButton() == noButton) {
                                     cancelBlasting();
                                     return;
                                 }
                             }
+
                             ui->pushButton_2->setEnabled(true);
                             ui->pushButton_2->setText("充电");
                             navProgress->setState(FiringStages::QuickTestFinished);