本文整理汇总了C++中KLineEdit::setPasswordMode方法的典型用法代码示例。如果您正苦于以下问题:C++ KLineEdit::setPasswordMode方法的具体用法?C++ KLineEdit::setPasswordMode怎么用?C++ KLineEdit::setPasswordMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLineEdit
的用法示例。
在下文中一共展示了KLineEdit::setPasswordMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SettingWidget
Security8021xAuthWidget::Security8021xAuthWidget(Knm::Connection* connection, const QStringList &secrets, QWidget * parent)
: SettingWidget(*new Security8021xAuthWidgetPrivate, parent)
{
Q_D(Security8021xAuthWidget);
d->connection = connection;
d->setting = static_cast<Knm::Security8021xSetting *>(connection->setting(Knm::Setting::Security8021x));
d->layout = new QFormLayout(this);
this->setLayout(d->layout);
if (secrets.contains(QLatin1String("password"))) {
QLabel *label = new QLabel(this);
label->setText(i18n("Password:"));
KLineEdit *lineEdit = new KLineEdit(this);
lineEdit->setPasswordMode(true);
lineEdit->setProperty("setting", "password");
d->layout->addRow(label, lineEdit);
}
if (secrets.contains(QLatin1String("private-key-password"))) {
QLabel *label = new QLabel(this);
label->setText(i18n("Private Key Password:"));
KLineEdit *lineEdit = new KLineEdit(this);
lineEdit->setPasswordMode(true);
lineEdit->setProperty("setting", "private-key-password");
d->layout->addRow(label, lineEdit);
}
if (secrets.contains(QLatin1String("phase2-private-key-password"))) {
QLabel *label = new QLabel(this);
label->setText(i18n("Phase 2 Private Key Password:"));
KLineEdit *lineEdit = new KLineEdit(this);
lineEdit->setPasswordMode(true);
lineEdit->setProperty("setting", "phase2-private-key-password");
d->layout->addRow(label, lineEdit);
}
for (int i = 0; i < d->layout->rowCount(); i++)
{
KLineEdit *le = qobject_cast<KLineEdit*>(d->layout->itemAt(i, QFormLayout::FieldRole)->widget());
if (le && le->text().isEmpty()) {
le->setFocus(Qt::OtherFocusReason);
break;
}
}
QCheckBox *showPasswords = new QCheckBox(this);
showPasswords->setText(i18n("&Show password"));
d->layout->setWidget(d->layout->rowCount(), QFormLayout::FieldRole, showPasswords);
connect(showPasswords, SIGNAL(toggled(bool)), this, SLOT(showPasswordsToggled(bool)));
d->layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding));
}
示例2:
void Security8021xAuthWidget::showPasswordsToggled(bool toggled)
{
Q_D(Security8021xAuthWidget);
for (int i = 0; i < d->layout->rowCount() - 1; i++)
{
KLineEdit *le = qobject_cast<KLineEdit*>(d->layout->itemAt(i, QFormLayout::FieldRole)->widget());
if (le) {
le->setPasswordMode(!toggled);
}
}
}