Skip to content

Commit

Permalink
bug fix for enter key
Browse files Browse the repository at this point in the history
  • Loading branch information
onurkepenek committed Mar 17, 2020
1 parent 17a2bf1 commit 7bb93a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/loginform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,14 @@ void LoginForm::keyPressEvent(QKeyEvent *event)

if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {



winClicked = false;

if(justshowed){
justshowed = false;
return;
}
if(ui->stackedWidget->currentIndex() == ui->stackedWidget->indexOf(ui->resetpage))
on_resetpasswordButton_clicked();
else if(ui->stackedWidget->currentIndex() == ui->stackedWidget->indexOf(ui->warningpage)){
Expand All @@ -1043,10 +1050,9 @@ void LoginForm::keyPressEvent(QKeyEvent *event)
ui->passwordInput->setFocus();
} else if(ui->userInput->hasFocus() && !ui->userInput->isHidden() && ui->passwordInput->text().isEmpty()){
ui->passwordInput->setFocus();
}else{
}else {
startLogin();
}

}
}
else if (event->key() == Qt::Key_Escape) {
Expand Down Expand Up @@ -1092,7 +1098,7 @@ void LoginForm::keyPressEvent(QKeyEvent *event)
QWidget::keyPressEvent(event);
}


justshowed = false;
}

void LoginForm::keyReleaseEvent(QKeyEvent *event){
Expand Down Expand Up @@ -2491,6 +2497,7 @@ void LoginForm::hideAll(void){
//ui->usersframe->hide();
// ui->userspage->hide();
ui->passwordInput->hide();
ui->passwordInput->clearFocus();
//ui->userInput->hide();

hide();
Expand Down Expand Up @@ -2518,9 +2525,14 @@ void LoginForm::showAll(void){
ui->passwordInput->setFocus();
else
ui->userInput->setFocus();

justshowed = true;
}

ishidden = false;
}


void LoginForm::on_passwordInput_textEdited(const QString &arg1)
{
justshowed = false;
}
3 changes: 3 additions & 0 deletions src/loginform.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ private slots:

void on_pushButton_left_clicked();

void on_passwordInput_textEdited(const QString &arg1);

private:
void initialize();

Expand Down Expand Up @@ -228,6 +230,7 @@ private slots:
bool winClicked;
QString currentSessionStr;
bool ishidden = false;
bool justshowed = false;



Expand Down

0 comments on commit 7bb93a6

Please sign in to comment.