调整开机登录页面、数字键盘

This commit is contained in:
xu
2026-09-09 21:57:25 +08:00
parent bc17390d83
commit 7650e2983d
20 changed files with 17820 additions and 626 deletions
+15 -5
View File
@@ -1,5 +1,6 @@
#include "passwordmgmtlogin.h"
#include "numpaddialog.h"
#include <QKeyEvent>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLineEdit>
@@ -33,7 +34,7 @@ PasswordMgmtLoginPage::PasswordMgmtLoginPage(AppContext* ctx, QWidget* parent)
m_input->setEchoMode(QLineEdit::Password);
m_input->setAlignment(Qt::AlignCenter);
m_input->setFixedSize(400, 88);
m_input->setFocusPolicy(Qt::NoFocus);
m_input->setFocusPolicy(Qt::StrongFocus);
m_input->installEventFilter(this);
lay->addWidget(m_input, 0, Qt::AlignHCenter);
@@ -44,7 +45,7 @@ PasswordMgmtLoginPage::PasswordMgmtLoginPage(AppContext* ctx, QWidget* parent)
QHBoxLayout* btnRow = new QHBoxLayout();
btnRow->addStretch(1);
QPushButton* ok = button("确认", "primary", col);
QPushButton* ok = button("确认", "", col);
ok->setFixedSize(180, 72);
connect(ok, &QPushButton::clicked, this, &PasswordMgmtLoginPage::onConfirm);
QPushButton* cancel = button("取消", "", col);
@@ -61,9 +62,18 @@ PasswordMgmtLoginPage::PasswordMgmtLoginPage(AppContext* ctx, QWidget* parent)
bool PasswordMgmtLoginPage::eventFilter(QObject* obj, QEvent* ev)
{
if (obj == m_input && ev->type() == QEvent::MouseButtonPress) {
onInputClicked();
return true;
if (obj == m_input) {
if (ev->type() == QEvent::MouseButtonPress) {
onInputClicked();
return true;
}
if (ev->type() == QEvent::KeyPress) {
QKeyEvent* ke = static_cast<QKeyEvent*>(ev);
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) {
onInputClicked();
return true;
}
}
}
return BasePage::eventFilter(obj, ev);
}