本文整理汇总了C++中WLineEdit::setEchoMode方法的典型用法代码示例。如果您正苦于以下问题:C++ WLineEdit::setEchoMode方法的具体用法?C++ WLineEdit::setEchoMode怎么用?C++ WLineEdit::setEchoMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WLineEdit
的用法示例。
在下文中一共展示了WLineEdit::setEchoMode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WLineEdit
WWidget *RegistrationWidget::createFormWidget(WFormModel::Field field)
{
WFormWidget *result = 0;
if (field == RegistrationModel::LoginNameField) {
result = new WLineEdit();
result->changed().connect
(boost::bind(&RegistrationWidget::checkLoginName, this));
} else if (field == RegistrationModel::EmailField) {
result = new WLineEdit();
} else if (field == RegistrationModel::ChoosePasswordField) {
WLineEdit *p = new WLineEdit();
p->setEchoMode(WLineEdit::Password);
p->keyWentUp().connect
(boost::bind(&RegistrationWidget::checkPassword, this));
p->changed().connect
(boost::bind(&RegistrationWidget::checkPassword, this));
result = p;
} else if (field == RegistrationModel::RepeatPasswordField) {
WLineEdit *p = new WLineEdit();
p->setEchoMode(WLineEdit::Password);
p->changed().connect
(boost::bind(&RegistrationWidget::checkPassword2, this));
result = p;
}
return result;
}
示例2: WLineEdit
WFormWidget *AuthWidget::createFormWidget(WFormModel::Field field)
{
WFormWidget *result = 0;
if (field == AuthModel::LoginNameField) {
result = new WLineEdit();
result->setFocus();
} else if (field == AuthModel::PasswordField) {
WLineEdit *p = new WLineEdit();
p->enterPressed().connect(this, &AuthWidget::attemptPasswordLogin);
p->setEchoMode(WLineEdit::Password);
result = p;
} else if (field == AuthModel::RememberMeField) {
result = new WCheckBox();
}
return result;
}
示例3: WDialog
PasswordPromptDialog::PasswordPromptDialog(Login& login, AuthModel *model)
: WDialog(tr("Wt.Auth.enter-password")),
login_(login),
model_(model)
{
impl_ = new WTemplateFormView(tr("Wt.Auth.template.password-prompt"));
model_->setValue(AuthModel::LoginNameField,
login_.user().identity(Identity::LoginName));
model_->setReadOnly(AuthModel::LoginNameField, true);
WLineEdit *nameEdit = new WLineEdit();
impl_->bindWidget(AuthModel::LoginNameField, nameEdit);
impl_->updateViewField(model_, AuthModel::LoginNameField);
WLineEdit *passwordEdit = new WLineEdit();
passwordEdit->setEchoMode(WLineEdit::Password);
passwordEdit->setFocus(true);
impl_->bindWidget(AuthModel::PasswordField, passwordEdit);
impl_->updateViewField(model_, AuthModel::PasswordField);
WPushButton *okButton = new WPushButton(tr("Wt.WMessageBox.Ok"));
WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));
model_->configureThrottling(okButton);
impl_->bindWidget("ok-button", okButton);
impl_->bindWidget("cancel-button", cancelButton);
okButton->clicked().connect(this, &PasswordPromptDialog::check);
cancelButton->clicked().connect(this, &PasswordPromptDialog::reject);
contents()->addWidget(impl_);
if (!WApplication::instance()->environment().ajax()) {
/*
* try to center it better, we need to set the half width and
* height as negative margins.
*/
setMargin(WLength("-21em"), Left); // .Wt-form width
setMargin(WLength("-200px"), Top); // ???
}
}
示例4: WTemplate
UpdatePasswordWidget::UpdatePasswordWidget(const User& user,
const AbstractPasswordService& auth,
Login& login,
bool promptPassword,
WContainerWidget *parent)
: WTemplate(tr("Wt.Auth.template.update-password"), parent),
user_(user),
promptPassword_(promptPassword),
validated_(false),
enterPasswordFields_(0)
{
addFunction("id", &WTemplate::Functions::id);
addFunction("tr", &WTemplate::Functions::tr);
WLineEdit *nameEdit = new WLineEdit(user.identity(Identity::LoginName));
nameEdit->disable();
nameEdit->addStyleClass("Wt-disabled");
bindWidget("user-name", nameEdit);
WPushButton *okButton = new WPushButton(tr("Wt.WMessageBox.Ok"));
WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));
if (promptPassword_) {
setCondition("if:old-password", true);
WLineEdit *oldPasswd = new WLineEdit();
WText *oldPasswdInfo = new WText();
enterPasswordFields_ = new EnterPasswordFields(auth,
oldPasswd, oldPasswdInfo,
okButton, this);
oldPasswd->setFocus();
bindWidget("old-password", oldPasswd);
bindWidget("old-password-info", oldPasswdInfo);
}
WLineEdit *password = new WLineEdit();
password->setEchoMode(WLineEdit::Password);
password->keyWentUp().connect
(boost::bind(&UpdatePasswordWidget::checkPassword, this));
password->changed().connect
(boost::bind(&UpdatePasswordWidget::checkPassword, this));
WText *passwordInfo = new WText();
WLineEdit *password2 = new WLineEdit();
password2->setEchoMode(WLineEdit::Password);
password2->changed().connect
(boost::bind(&UpdatePasswordWidget::checkPassword2, this));
WText *password2Info = new WText();
bindWidget("choose-password", password);
bindWidget("choose-password-info", passwordInfo);
bindWidget("repeat-password", password2);
bindWidget("repeat-password-info", password2Info);
model_ = new RegistrationModel(auth.baseAuth(), *user.database(),
login, this);
model_->addPasswordAuth(&auth);
model_->setValue(RegistrationModel::LoginName,
user.identity(Identity::LoginName));
model_->setValue(RegistrationModel::Email,
WT_USTRING::fromUTF8(user.email() + " "
+ user.unverifiedEmail()));
model_->validatePasswordsMatchJS(password, password2, password2Info);
passwordInfo->setText(model_->validationResult
(RegistrationModel::Password).message());
password2Info->setText(model_->validationResult
(RegistrationModel::Password2).message());
okButton->clicked().connect(this, &UpdatePasswordWidget::doUpdate);
cancelButton->clicked().connect(this, &UpdatePasswordWidget::close);
bindWidget("ok-button", okButton);
bindWidget("cancel-button", cancelButton);
if (!promptPassword_)
password->setFocus();
}