调整开机登录页面、数字键盘
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user