Skip to content
Permalink
Browse files
Tab order implemented for templated (and auto-templated) fields
  • Loading branch information
annejan committed Nov 17, 2015
1 parent 06c9e54 commit 2f9c6f7dd01ab524e4ae7ef8f832e4059733942d
Showing with 7 additions and 0 deletions.
  1. +7 −0 passworddialog.cpp
@@ -41,6 +41,7 @@ void PasswordDialog::setPassword(QString password)
ui->lineEditPassword->setText(tokens[0]);
tokens.pop_front();
if (templating) {
QWidget *previous = ui->checkBoxShow;
for (int i = 0; i < ui->formLayout->rowCount(); i++) {
QLayoutItem *item = ui->formLayout->itemAt(i, QFormLayout::FieldRole);
if (item == NULL) {
@@ -55,6 +56,7 @@ void PasswordDialog::setPassword(QString password)
((QLineEdit*)widget)->setText(value);
}
}
previous = widget;
}
if (allFields) {
for (int j = 0; j < tokens.length(); j++) {
@@ -70,6 +72,8 @@ void PasswordDialog::setPassword(QString password)
line->setObjectName(field);
line->setText(value);
ui->formLayout->addRow(new QLabel(field), line);
setTabOrder(previous, line);
previous = line;
tokens.removeAt(j);
j--; // tokens.length() also got shortened by the remove..
}
@@ -100,13 +104,16 @@ QString PasswordDialog::getPassword()

void PasswordDialog::setTemplate(QString rawFields) {
fields = rawFields.split('\n');
QWidget *previous = ui->checkBoxShow;
foreach (QString field, fields) {
if (field.isEmpty()) {
continue;
}
QLineEdit *line = new QLineEdit();
line->setObjectName(field);
ui->formLayout->addRow(new QLabel(field), line);
setTabOrder(previous, line);
previous = line;
}
}

0 comments on commit 2f9c6f7

Please sign in to comment.