调试初版
This commit is contained in:
@@ -36,7 +36,7 @@ BootPasswordPage::BootPasswordPage(AppContext* ctx, QWidget* parent)
|
||||
m_input->setEchoMode(QLineEdit::Password);
|
||||
m_input->setAlignment(Qt::AlignCenter);
|
||||
m_input->setFixedSize(450, 120);
|
||||
m_input->setStyleSheet("font-size:80px");
|
||||
m_input->setStyleSheet("font-size:50px");
|
||||
m_input->setProperty("clickable", true);
|
||||
lay->addWidget(m_input, 0, Qt::AlignHCenter);
|
||||
//lay->addSpacing(20);
|
||||
@@ -55,11 +55,11 @@ BootPasswordPage::BootPasswordPage(AppContext* ctx, QWidget* parent)
|
||||
btnRow->setSpacing(80);
|
||||
btnRow->addStretch(1);
|
||||
QPushButton* ok = button("确认", "", col);
|
||||
ok->setFixedSize(160, 140);
|
||||
ok->setFixedSize(160, 100);
|
||||
ok->setStyleSheet("font-size:60px;");
|
||||
connect(ok, &QPushButton::clicked, this, &BootPasswordPage::onConfirm);
|
||||
QPushButton* cancel = button("取消", "", col);
|
||||
cancel->setFixedSize(160, 140);
|
||||
QPushButton* cancel = button("清空", "", col);
|
||||
cancel->setFixedSize(160, 100);
|
||||
cancel->setStyleSheet(cancelButtonStyle(60)); // 选中时红底白字
|
||||
connect(cancel, &QPushButton::clicked, this, &BootPasswordPage::onCancel);
|
||||
btnRow->addWidget(ok);
|
||||
@@ -93,7 +93,8 @@ bool BootPasswordPage::eventFilter(QObject* obj, QEvent* ev)
|
||||
}
|
||||
if (ev->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(ev);
|
||||
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
|
||||
// 空格当“点击”:Tab 聚焦后按空格弹出数字键盘
|
||||
if (Keys::space(ke->key())) {
|
||||
onInputClicked();
|
||||
return true;
|
||||
}
|
||||
@@ -155,5 +156,5 @@ void BootPasswordPage::refreshInput()
|
||||
// 空态:无论是否被选中都显示提示文字(灰字);有内容:显示密码圆点
|
||||
m_input->setEchoMode(empty ? QLineEdit::Normal : QLineEdit::Password);
|
||||
m_input->setText(empty ? "点击输入密码" : m_value);
|
||||
m_input->setStyleSheet(empty ? "font-size:50px;color:#9AA7B4;" : "font-size:80px;");
|
||||
m_input->setStyleSheet(empty ? "font-size:50px;color:#9AA7B4;" : "font-size:50px;");
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ DebugMaintainPage::DebugMaintainPage(AppContext* ctx, QWidget* parent)
|
||||
QPushButton* back = button("返回", "", bottom);
|
||||
back->setFixedSize(160, 76);
|
||||
back->setStyleSheet(cancelButtonStyle(40)); // 选中(悬停/按下/焦点)红底白字
|
||||
connect(back, &QPushButton::clicked, this, [this]() { emit navigate(PageJob); });
|
||||
connect(back, &QPushButton::clicked, this, [this]() { emit navigate(m_returnPage); });
|
||||
bottomLay->addWidget(back);
|
||||
root->addWidget(bottom);
|
||||
|
||||
@@ -129,8 +129,6 @@ DebugMaintainPage::DebugMaintainPage(AppContext* ctx, QWidget* parent)
|
||||
});
|
||||
|
||||
// Tab 顺序(循环):返回 → D1控制 → D2控制 → 各泵(转速输入 → 启动 → 停止) → 回到返回。
|
||||
// 这些按钮在控件级样式表里写了 :checked,而控件级样式表的优先级高于全局
|
||||
// QPushButton:focus,默认焦点链下容易看起来“停不上去”,故显式排一遍保证都能停住
|
||||
QWidget* tabChain[] = {
|
||||
m_valve1Btn, m_valve2Btn,
|
||||
m_airRpm->editor(), m_airStart, m_airStop,
|
||||
|
||||
@@ -19,6 +19,8 @@ class DebugMaintainPage : public BasePage
|
||||
public:
|
||||
explicit DebugMaintainPage(AppContext* ctx, QWidget* parent = nullptr);
|
||||
|
||||
void setReturnPage(PageId id) { m_returnPage = id; }
|
||||
|
||||
private slots:
|
||||
void refresh();
|
||||
|
||||
@@ -64,6 +66,9 @@ private:
|
||||
|
||||
// 是否收到过车端遥测:未收到时球阀到位灯保持“开启=绿、关闭=红”的缺省显示
|
||||
bool m_telemetrySeen = false;
|
||||
|
||||
// “返回”去向:本页有两个入口(系统首页 / 作业选择),由 MainWindow 记录来源后原路返回
|
||||
PageId m_returnPage = PageJob;
|
||||
};
|
||||
|
||||
#endif // DEBUGMAINTAINPAGE_H
|
||||
|
||||
+4
-4
@@ -41,7 +41,7 @@ HomePage::HomePage(AppContext* ctx, QWidget* parent)
|
||||
leftLay->setSpacing(100);
|
||||
auto addMenu = [&](const QString& t, PageId id) {
|
||||
QPushButton* b = button(t, "", left);
|
||||
b->setFixedSize(260, 100); // 固定尺寸(改这里同时调整 2 个菜单按钮)
|
||||
b->setFixedSize(260, 120); // 固定尺寸(改这里同时调整 2 个菜单按钮)
|
||||
b->setStyleSheet(menuBtnStyle);
|
||||
connect(b, &QPushButton::clicked, this, [this, id]() { emit navigate(id); });
|
||||
leftLay->addWidget(b, 0, Qt::AlignHCenter); // 不占拉伸因子,余量交给上下 stretch 均分
|
||||
@@ -89,15 +89,15 @@ HomePage::HomePage(AppContext* ctx, QWidget* parent)
|
||||
rightLay->setContentsMargins(0, 0, 0, 0);
|
||||
rightLay->setSpacing(24);
|
||||
QPushButton* debug = button("调试维护", "", right);
|
||||
debug->setFixedSize(240, 100);
|
||||
debug->setFixedSize(240, 120);
|
||||
debug->setStyleSheet(actionBtnStyle);
|
||||
connect(debug, &QPushButton::clicked, this, [this]() { emit navigate(PageDebug); });
|
||||
QPushButton* help = button("操作说明", "", right);
|
||||
help->setFixedSize(240, 100);
|
||||
help->setFixedSize(240, 120);
|
||||
help->setStyleSheet(actionBtnStyle);
|
||||
connect(help, &QPushButton::clicked, this, &HomePage::onHelp);
|
||||
QPushButton* spare = button("备用", "", right);
|
||||
spare->setFixedSize(240, 100);
|
||||
spare->setFixedSize(240, 120);
|
||||
spare->setStyleSheet(actionBtnStyle);
|
||||
spare->setEnabled(false); // 预留功能:置灰禁用,不接任何跳转
|
||||
rightLay->addStretch(1);
|
||||
|
||||
+57
-5
@@ -4,8 +4,53 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include <QEvent>
|
||||
#include <QColor>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include "global.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class CardFocusGlow : public QObject
|
||||
{
|
||||
public:
|
||||
CardFocusGlow(QWidget* card, const QString& normalQss, const QString& focusQss,
|
||||
const QColor& glow, QObject* parent = nullptr)
|
||||
: QObject(parent), m_card(card), m_normal(normalQss), m_focus(focusQss), m_glow(glow) {}
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* obj, QEvent* ev) override
|
||||
{
|
||||
if (ev->type() == QEvent::FocusIn) {
|
||||
m_card->setStyleSheet(m_focus);
|
||||
if (!m_card->graphicsEffect()) {
|
||||
QGraphicsDropShadowEffect* g = new QGraphicsDropShadowEffect(m_card); // 偏移 0 → 四周光晕
|
||||
g->setBlurRadius(40);
|
||||
g->setOffset(0, 0);
|
||||
g->setColor(m_glow);
|
||||
m_card->setGraphicsEffect(g);
|
||||
}
|
||||
} else if (ev->type() == QEvent::FocusOut) {
|
||||
m_card->setStyleSheet(m_normal);
|
||||
QWidget* parent = m_card->parentWidget();
|
||||
// 光晕溢出卡片矩形,只重绘卡片自身会留下残影,把父控件一并标脏
|
||||
m_card->setGraphicsEffect(nullptr); // Qt 会删除旧效果
|
||||
m_card->update();
|
||||
if (parent)
|
||||
parent->update(parent->rect());
|
||||
}
|
||||
return QObject::eventFilter(obj, ev);
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget* m_card;
|
||||
QString m_normal;
|
||||
QString m_focus;
|
||||
QColor m_glow;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
PasswordMgmtPage::PasswordMgmtPage(AppContext* ctx, QWidget* parent)
|
||||
: BasePage(ctx, parent)
|
||||
{
|
||||
@@ -25,16 +70,23 @@ PasswordMgmtPage::PasswordMgmtPage(AppContext* ctx, QWidget* parent)
|
||||
// 功能选项列表
|
||||
QWidget* option = new QWidget(col);
|
||||
option->setProperty("card", true);
|
||||
option->setStyleSheet(QString("QWidget[card=\"true\"]{background-color:%1;border:2px solid %2;border-radius:12px;}")
|
||||
.arg(C::PANEL, C::BORDER));
|
||||
const QString cardQss = QString("QWidget[card=\"true\"]{background-color:%1;border:2px solid %2;border-radius:12px;}")
|
||||
.arg(C::PANEL, C::BORDER);
|
||||
const QString cardFocusQss = QString("QWidget[card=\"true\"]{background-color:%1;border:3px solid %2;border-radius:12px;}")
|
||||
.arg(C::PANEL, "#8ABFFF");
|
||||
option->setStyleSheet(cardQss);
|
||||
QVBoxLayout* optLay = new QVBoxLayout(option);
|
||||
m_reset = new QCheckBox("重置密码功能", option);
|
||||
m_reset->setChecked(true);
|
||||
m_reset->setStyleSheet(QString(
|
||||
"QCheckBox{color:%1;font-size:40px;spacing:16px;}"
|
||||
"QCheckBox::indicator{width:40px;height:40px;border:2px solid %2;border-radius:6px;background-color:%3;}"
|
||||
"QCheckBox::indicator:checked{background-color:%4;border-color:%4;image:none;}")
|
||||
"QCheckBox::indicator:checked{background-color:%4;border-color:%4;image:none;}"
|
||||
"QCheckBox:focus{color:#FFFFFF;}"
|
||||
"QCheckBox:focus::indicator{border:4px solid #8ABFFF;}")
|
||||
.arg(C::TEXT, C::BORDER, C::BG, C::PRIMARY));
|
||||
// 复选框获得焦点(Tab 选中)时点亮整个卡片
|
||||
m_reset->installEventFilter(new CardFocusGlow(option, cardQss, cardFocusQss, QColor("#7FBBFF"), m_reset));
|
||||
optLay->addWidget(m_reset);
|
||||
lay->addWidget(option);
|
||||
|
||||
@@ -43,11 +95,11 @@ PasswordMgmtPage::PasswordMgmtPage(AppContext* ctx, QWidget* parent)
|
||||
btnRow->setSpacing(80);
|
||||
btnRow->addStretch(1);
|
||||
QPushButton* ok = button("确认", "", col);
|
||||
ok->setFixedSize(160, 140);
|
||||
ok->setFixedSize(160, 120);
|
||||
ok->setStyleSheet("font-size:60px;");
|
||||
connect(ok, &QPushButton::clicked, this, [this]() { emit navigate(PageReset); });
|
||||
QPushButton* exit = button("退出", "", col);
|
||||
exit->setFixedSize(160, 140);
|
||||
exit->setFixedSize(160, 120);
|
||||
exit->setStyleSheet(cancelButtonStyle(60)); // 选中时红底白字
|
||||
connect(exit, &QPushButton::clicked, this, [this]() { emit navigate(PageBoot); });
|
||||
btnRow->addWidget(ok);
|
||||
|
||||
@@ -49,11 +49,11 @@ PasswordMgmtLoginPage::PasswordMgmtLoginPage(AppContext* ctx, QWidget* parent)
|
||||
btnRow->setSpacing(80);
|
||||
btnRow->addStretch(1);
|
||||
QPushButton* ok = button("确认", "", col);
|
||||
ok->setFixedSize(160, 140);
|
||||
ok->setFixedSize(160, 120);
|
||||
ok->setStyleSheet("font-size:60px;");
|
||||
connect(ok, &QPushButton::clicked, this, &PasswordMgmtLoginPage::onConfirm);
|
||||
QPushButton* cancel = button("取消", "", col);
|
||||
cancel->setFixedSize(160, 140);
|
||||
cancel->setFixedSize(160, 120);
|
||||
cancel->setStyleSheet(cancelButtonStyle(60)); // 选中时红底白字
|
||||
connect(cancel, &QPushButton::clicked, this, &PasswordMgmtLoginPage::onCancel);
|
||||
btnRow->addWidget(ok);
|
||||
@@ -74,7 +74,8 @@ bool PasswordMgmtLoginPage::eventFilter(QObject* obj, QEvent* ev)
|
||||
}
|
||||
if (ev->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(ev);
|
||||
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
|
||||
// 空格当“点击”:Tab 聚焦后按空格弹出数字键盘
|
||||
if (Keys::space(ke->key())) {
|
||||
onInputClicked();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -44,15 +44,15 @@ PasswordResetPage::PasswordResetPage(AppContext* ctx, QWidget* parent)
|
||||
btnRow->setSpacing(80);
|
||||
btnRow->addStretch(1);
|
||||
QPushButton* ok = button("确认", "", col);
|
||||
ok->setFixedSize(160, 140);
|
||||
ok->setFixedSize(160, 120);
|
||||
ok->setStyleSheet("font-size:60px;");
|
||||
connect(ok, &QPushButton::clicked, this, &PasswordResetPage::onConfirm);
|
||||
QPushButton* cancel = button("取消", "", col);
|
||||
cancel->setFixedSize(160, 140);
|
||||
cancel->setFixedSize(160, 120);
|
||||
cancel->setStyleSheet(cancelButtonStyle(60)); // 选中时红底白字
|
||||
connect(cancel, &QPushButton::clicked, this, &PasswordResetPage::onBack);
|
||||
QPushButton* exit = button("退出", "", col);
|
||||
exit->setFixedSize(160, 140);
|
||||
exit->setFixedSize(160, 120);
|
||||
exit->setStyleSheet(cancelButtonStyle(60)); // 选中时红底白字
|
||||
connect(exit, &QPushButton::clicked, this, &PasswordResetPage::onExit);
|
||||
btnRow->addWidget(ok);
|
||||
@@ -74,7 +74,8 @@ bool PasswordResetPage::eventFilter(QObject* obj, QEvent* ev)
|
||||
}
|
||||
if (ev->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(ev);
|
||||
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
|
||||
// 空格当“点击”:Tab 聚焦后按空格弹出数字键盘
|
||||
if (Keys::space(ke->key())) {
|
||||
onInputClicked();
|
||||
return true;
|
||||
}
|
||||
|
||||
+15
-12
@@ -28,18 +28,17 @@ SelfCheckPage::SelfCheckPage(AppContext* ctx, QWidget* parent)
|
||||
main->setContentsMargins(20, 30, 20, 30);
|
||||
main->setSpacing(40);
|
||||
|
||||
// 两侧按钮统一样式:字号在此统一调整;按钮会拉伸填满整列(sideBtnH 为最小高度)
|
||||
const int sideBtnH = 130;
|
||||
// 两侧按钮统一样式:左右两列 5 个按钮统一高度 sideBtnH,字号在此统一调整
|
||||
const int sideBtnH = 120;
|
||||
const QString sideBtnStyle = "font-size:60px;";
|
||||
auto makeSideBtn = [&](const QString& text, const QString& variant, QWidget* parent) {
|
||||
QPushButton* b = button(text, variant, parent);
|
||||
b->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); // 纵向可拉伸
|
||||
b->setMinimumHeight(sideBtnH);
|
||||
b->setFixedHeight(sideBtnH); // 左右两列共用同一高度值
|
||||
b->setStyleSheet(sideBtnStyle);
|
||||
return b;
|
||||
};
|
||||
|
||||
// 左按钮列(按钮按列高平分,填满整列)
|
||||
// 左按钮列(高度统一为 sideBtnH,整列垂直居中)
|
||||
QWidget* left = new QWidget(this);
|
||||
QVBoxLayout* leftLay = new QVBoxLayout(left);
|
||||
leftLay->setContentsMargins(20, 220, 20, 220);
|
||||
@@ -49,8 +48,10 @@ SelfCheckPage::SelfCheckPage(AppContext* ctx, QWidget* parent)
|
||||
m_ignore = makeSideBtn("忽略故障", "", left);
|
||||
connect(m_ignore, &QPushButton::clicked, this, &SelfCheckPage::onIgnoreFault);
|
||||
m_ignore->setEnabled(false);
|
||||
leftLay->addWidget(m_faultQuery, 1);
|
||||
leftLay->addWidget(m_ignore, 1);
|
||||
leftLay->addStretch(1);
|
||||
leftLay->addWidget(m_faultQuery);
|
||||
leftLay->addWidget(m_ignore);
|
||||
leftLay->addStretch(1);
|
||||
left->setFixedWidth(300);
|
||||
main->addWidget(left);
|
||||
|
||||
@@ -106,11 +107,11 @@ SelfCheckPage::SelfCheckPage(AppContext* ctx, QWidget* parent)
|
||||
|
||||
main->addWidget(center, 1);
|
||||
|
||||
// 右按钮列(按钮按列高平分,填满整列)
|
||||
// 右按钮列(高度统一为 sideBtnH,整列垂直居中)
|
||||
QWidget* right = new QWidget(this);
|
||||
QVBoxLayout* rightLay = new QVBoxLayout(right);
|
||||
rightLay->setContentsMargins(20, 140, 20, 140);
|
||||
rightLay->setSpacing(140);
|
||||
rightLay->setSpacing(100);
|
||||
QPushButton* help = makeSideBtn("操作说明", "", right);
|
||||
connect(help, &QPushButton::clicked, this, &SelfCheckPage::onHelp);
|
||||
QPushButton* start = makeSideBtn("启动自检", "", right);
|
||||
@@ -118,9 +119,11 @@ SelfCheckPage::SelfCheckPage(AppContext* ctx, QWidget* parent)
|
||||
m_job = makeSideBtn("作业选择", "", right);
|
||||
connect(m_job, &QPushButton::clicked, this, &SelfCheckPage::onJobSelect);
|
||||
m_job->setEnabled(false);
|
||||
rightLay->addWidget(help, 1);
|
||||
rightLay->addWidget(start, 1);
|
||||
rightLay->addWidget(m_job, 1);
|
||||
rightLay->addStretch(1);
|
||||
rightLay->addWidget(help);
|
||||
rightLay->addWidget(start);
|
||||
rightLay->addWidget(m_job);
|
||||
rightLay->addStretch(1);
|
||||
right->setFixedWidth(300);
|
||||
main->addWidget(right);
|
||||
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ WashPage::WashPage(AppContext* ctx, Mode mode, QWidget* parent)
|
||||
main->addWidget(left);
|
||||
|
||||
// 中央洗消卡
|
||||
m_washCard = new DataCard(clean ? "洗消(消除作业)" : "洗消(消毒作业)", this);
|
||||
m_washCard = new DataCard("洗消", this);
|
||||
m_fMode = m_washCard->addField("洗消模式", "--");
|
||||
m_fLevelA = m_washCard->addField("A组分液位", "100L");
|
||||
m_fLevelFoam = m_washCard->addField("泡沫箱液位", "30L");
|
||||
|
||||
Reference in New Issue
Block a user