-
Notifications
You must be signed in to change notification settings - Fork 38
/
password.cpp
46 lines (38 loc) · 1.4 KB
/
password.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* This work is distributed under the Lesser General Public License,
* see LICENSE for details
*
* @author Gwennaël ARBONA
**/
#include "password.h"
/*----------------------------------------------
Constructor & destructor
----------------------------------------------*/
Password::Password(QWidget *parent) :
QDialog(parent)
{
QGridLayout* formGridLayout = new QGridLayout(this);
editPassword = new QLineEdit(this);
editPassword->setEchoMode(QLineEdit::Password);
buttons = new QDialogButtonBox(this);
buttons->addButton(QDialogButtonBox::Ok);
buttons->addButton(QDialogButtonBox::Cancel);
buttons->button(QDialogButtonBox::Ok)->setText("Login");
buttons->button(QDialogButtonBox::Cancel)->setText("Abort");
connect(buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, parent, &QDialog::close);
connect(buttons->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &Password::SlotPasswordEntered);
formGridLayout->addWidget(editPassword, 0, 0);
formGridLayout->addWidget(buttons, 1, 0, 1, 2);
setLayout(formGridLayout);
setWindowTitle("Password");
setModal(true);
}
/*----------------------------------------------
Slots
----------------------------------------------*/
/*--- Signal the password entry ---*/
void Password::SlotPasswordEntered()
{
emit PasswordEntered(editPassword->text());
close();
}