自检页面调试完成

This commit is contained in:
xu
2026-09-10 14:10:40 +08:00
parent 0baf228c67
commit 32878a9a80
34 changed files with 595 additions and 1568 deletions
+36 -19
View File
@@ -18,31 +18,49 @@ TitleBar::TitleBar(AppContext* ctx, QWidget* parent)
setStyleSheet(QString("QWidget#TitleBar{background-color:%1;border-bottom:1px solid %2;}")
.arg(C::PANEL, C::BORDER));
QHBoxLayout* lay = new QHBoxLayout(this);
lay->setContentsMargins(24, 0, 24, 0);
lay->setSpacing(20);
// 通信状态
m_comm = new LedIndicator("通信正常", this);
// 左侧区(通信状态)
QWidget* leftBox = new QWidget(this);
QHBoxLayout* leftLay = new QHBoxLayout(leftBox);
leftLay->setContentsMargins(0, 0, 0, 0);
leftLay->setSpacing(20);
m_comm = new LedIndicator("通信正常", leftBox);
m_comm->setState(LedIndicator::Green);
lay->addWidget(m_comm);
leftLay->addWidget(m_comm);
leftLay->addStretch(1);
// 右侧区(时间 + 软急停)
QWidget* rightBox = new QWidget(this);
QHBoxLayout* rightLay = new QHBoxLayout(rightBox);
rightLay->setContentsMargins(0, 0, 0, 0);
rightLay->setSpacing(20);
m_time = new QLabel("", rightBox);
m_time->setStyleSheet(QString("color:%1;font-size:60px;").arg(C::TEXT_SUB));
m_time->setAlignment(Qt::AlignCenter);
m_estop = new QPushButton("急停", rightBox);
m_estop->setProperty("variant", "estop");
m_estop->setStyleSheet("font-size:60px;");
m_estop->setFixedSize(180, 80);
rightLay->addStretch(1);
rightLay->addWidget(m_time);
rightLay->addWidget(m_estop);
// 左右两侧等宽 → 中间标题恰好居中于屏幕
const int sideW = 380; // 需 >= 较宽一侧所需宽度(右侧:时间 + 急停)
leftBox->setFixedWidth(sideW);
rightBox->setFixedWidth(sideW);
// 标题(居中)
m_title = new QLabel("", this);
m_title->setAlignment(Qt::AlignCenter);
m_title->setStyleSheet(QString("color:%1;font-size:40px;font-weight:700;").arg(C::TEXT));
m_title->setStyleSheet(QString("color:%1;font-size:60px;font-weight:700;").arg(C::TEXT));
QHBoxLayout* lay = new QHBoxLayout(this);
lay->setContentsMargins(24, 6, 24, 6);
lay->setSpacing(0);
lay->addWidget(leftBox);
lay->addWidget(m_title, 1);
lay->addWidget(rightBox);
// 时间
m_time = new QLabel("", this);
m_time->setStyleSheet(QString("color:%1;font-size:26px;").arg(C::TEXT_SUB));
m_time->setAlignment(Qt::AlignCenter);
lay->addWidget(m_time);
// 软急停按钮
m_estop = new QPushButton("急停", this);
m_estop->setProperty("variant", "estop");
m_estop->setFixedSize(130, 64);
connect(m_estop, &QPushButton::clicked, this, [this]() {
if (m_ctx->estopTriggered) {
if (ConfirmDialog::confirm(window(), "急停复位", "确定复位急停并恢复系统?"))
@@ -51,7 +69,6 @@ TitleBar::TitleBar(AppContext* ctx, QWidget* parent)
m_ctx->triggerEstop();
}
});
lay->addWidget(m_estop);
// 通信状态刷新
connect(m_ctx->comm(), &UdpCommunication::commOkChanged, this, [this](bool ok) {