feat: add keyboard event handling for Enter and Escape keys in login dialog

fix(ci): remove running openssl version
This commit is contained in:
Chenx Dust
2025-01-10 00:09:16 +08:00
parent 8f9eb825e8
commit 7799d6784c
3 changed files with 14 additions and 1 deletions

View File

@@ -336,7 +336,6 @@ jobs:
run: |
echo '${GITHUB_WORKSPACE}/openssl-bin/lib64' | sudo tee /etc/ld.so.conf.d/openssl.conf > /dev/null
sudo ldconfig
${GITHUB_WORKSPACE}/openssl-bin/bin/openssl version
sudo apt install -y libxcb-cursor0 fuse

View File

@@ -4,6 +4,7 @@
#include <QMessageBox>
#include <QPushButton>
#include <QKeyEvent>
LoginWindow::LoginWindow(QWidget *parent)
: QDialog(parent),
@@ -42,3 +43,14 @@ void LoginWindow::setDetail(const QString& username, const QString& password)
ui->usernameLineEdit->setText(username);
ui->passwordLineEdit->setText(password);
}
void LoginWindow::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
ui->buttonBox->button(QDialogButtonBox::Ok)->click();
else if (event->key() == Qt::Key_Escape)
reject();
else
QDialog::keyPressEvent(event);
}

View File

@@ -14,6 +14,8 @@ public:
void setDetail(const QString& username, const QString& password);
void keyPressEvent(QKeyEvent *event) override;
signals:
void login(const QString& username, const QString& password, bool saveDetail);