#include #include "pindialog.h" PinDialog::PinDialog(QWidget *parent) : QDialog(parent) { label=new QLabel(tr("Enter &PIN:")); lineEdit=new QLineEdit; lineEdit->setEchoMode(QLineEdit::Password); label->setBuddy(lineEdit); okButton=new QPushButton(tr("&OK")); okButton->setDefault(true); cancelButton=new QPushButton(tr("&Cancel")); connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); QHBoxLayout* tl= new QHBoxLayout; tl->addWidget(label); tl->addWidget(lineEdit); QHBoxLayout* bl= new QHBoxLayout; bl->addStretch(); bl->addWidget(okButton); bl->addWidget(cancelButton); QVBoxLayout* ml= new QVBoxLayout; ml->addLayout(tl); ml->addLayout(bl); setLayout(ml); } QString PinDialog::pin() const { // TODO: Cleanup of internal strings as soon as the PIN is retrieved return lineEdit ? lineEdit->text() : ""; }