本文整理汇总了C++中WLineEdit类的典型用法代码示例。如果您正苦于以下问题:C++ WLineEdit类的具体用法?C++ WLineEdit怎么用?C++ WLineEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WLineEdit类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: editState
boost::any WItemDelegate::editState(WWidget *editor) const
{
WContainerWidget *w = dynamic_cast<WContainerWidget *>(editor);
WLineEdit *lineEdit = dynamic_cast<WLineEdit *>(w->widget(0));
return boost::any(lineEdit->text());
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:7,代码来源:WItemDelegate.C
示例2: setEditState
void WItemDelegate::setEditState(WWidget *editor, const boost::any& value) const
{
WContainerWidget *w = dynamic_cast<WContainerWidget *>(editor);
WLineEdit *lineEdit = dynamic_cast<WLineEdit *>(w->widget(0));
lineEdit->setText(boost::any_cast<WT_USTRING>(value));
}
开发者ID:NeilNienaber,项目名称:wt,代码行数:7,代码来源:WItemDelegate.C
示例3: WContainerWidget
WWidget *FormWidgets::wSuggestionPopup()
{
WContainerWidget *result = new WContainerWidget();
topic("WSuggestionPopup", result);
addText(tr("formwidgets-WSuggestionPopup"), result);
// options for email address suggestions
WSuggestionPopup::Options contactOptions;
contactOptions.highlightBeginTag = "<span class=\"highlight\">";
contactOptions.highlightEndTag = "</span>";
contactOptions.listSeparator = ',';
contactOptions.whitespace = " \\n";
contactOptions.wordSeparators = "-., \"@\\n;";
contactOptions.appendReplacedText = ", ";
WSuggestionPopup *sp =
new WSuggestionPopup(WSuggestionPopup::generateMatcherJS(contactOptions),
WSuggestionPopup::generateReplacerJS(contactOptions),
result);
WLineEdit *le = new WLineEdit(result);
le->setTextSize(50);
le->setInline(false);
sp->forEdit(le);
sp->addSuggestion("John Tech <[email protected]>",
"John Tech <[email protected]>");
sp->addSuggestion("Johnny Cash <[email protected]>",
"Johnny Cash <[email protected]>");
sp->addSuggestion("John Rambo <[email protected]>",
"John Rambo <[email protected]>");
sp->addSuggestion("Johanna Tree <[email protected]>",
"Johanna Tree <[email protected]>");
return result;
}
开发者ID:StevenFarley,项目名称:wt,代码行数:35,代码来源:FormWidgets.C
示例4: GravatarApp
GravatarApp(const WEnvironment& env):
WApplication(env) {
GravatarImage* gravatar = new GravatarImage("[email protected]", root());
new WBreak(root());
WLineEdit* email = new WLineEdit(root());
email->changed().connect(boost::bind(set_email, gravatar, email));
email->setText("[email protected]");
new WBreak(root());
WSlider* size = new WSlider(root());
size->setRange(1, 512);
size->setValue(80);
size->valueChanged().connect(boost::bind(set_size, gravatar, size));
new WBreak(root());
WButtonGroup* builtin = new WButtonGroup(this);
builtin->addButton(new WRadioButton("default", root()),
GravatarImage::DEFAULT);
builtin->addButton(new WRadioButton("404", root()),
GravatarImage::RETURN_404);
builtin->addButton(new WRadioButton("mm", root()),
GravatarImage::MM);
builtin->addButton(new WRadioButton("identicon", root()),
GravatarImage::IDENTICON);
builtin->addButton(new WRadioButton("monsterid", root()),
GravatarImage::MONSTERID);
builtin->addButton(new WRadioButton("wavatar", root()),
GravatarImage::WAVATAR);
builtin->addButton(new WRadioButton("retro", root()),
GravatarImage::RETRO);
builtin->addButton(new WRadioButton("custom url", root()),
9000);
WLineEdit* custom_url = new WLineEdit(root());
custom_url->setText("https://www.google.com/favicon.ico");
builtin->setCheckedButton(builtin->button(GravatarImage::DEFAULT));
builtin->checkedChanged().connect(boost::bind(set_default,
gravatar, builtin, custom_url));
new WBreak(root());
WButtonGroup* rating = new WButtonGroup(this);
rating->addButton(new WRadioButton("G", root()), GravatarImage::G);
rating->addButton(new WRadioButton("PG", root()), GravatarImage::PG);
rating->addButton(new WRadioButton("R", root()), GravatarImage::R);
rating->addButton(new WRadioButton("X", root()), GravatarImage::X);
rating->setCheckedButton(rating->button(GravatarImage::G));
rating->checkedChanged().connect(boost::bind(set_rating,
gravatar, rating));
new WBreak(root());
WCheckBox* fd = new WCheckBox("Force default", root());
fd->checked().connect(boost::bind(&GravatarImage::set_force_default,
gravatar, true));
fd->unChecked().connect(boost::bind(&GravatarImage::set_force_default,
gravatar, false));
new WBreak(root());
WCheckBox* sr = new WCheckBox("Use https", root());
sr->setTristate();
sr->setCheckState(PartiallyChecked);
sr->checked().connect(boost::bind(&GravatarImage::set_secure_requests,
gravatar, GravatarImage::ALWAYS));
sr->unChecked().connect(boost::bind(&GravatarImage::set_secure_requests,
gravatar, GravatarImage::NEVER));
}
开发者ID:NCAR,项目名称:wt-classes,代码行数:59,代码来源:gravatar.cpp
示例5: WContainerWidget
WWidget *EventsDemo::wKeyEvent()
{
WContainerWidget *result = new WContainerWidget();
topic("WKeyEvent", result);
addText(tr("events-WKeyEvent-1"), result);
WLineEdit *l = new WLineEdit(result);
l->setTextSize(50);
l->keyWentUp().connect(this, &EventsDemo::showKeyWentUp);
l->keyWentDown().connect(this, &EventsDemo::showKeyWentDown);
addText(tr("events-WKeyEvent-2"), result);
l = new WLineEdit(result);
l->setTextSize(50);
l->keyPressed().connect(this, &EventsDemo::showKeyPressed);
addText(tr("events-WKeyEvent-3"), result);
l = new WLineEdit(result);
l->setTextSize(50);
l->enterPressed().connect(this, &EventsDemo::showEnterPressed);
l->escapePressed().connect(this, &EventsDemo::showEscapePressed);
new WBreak(result);
addText("Last event: ", result);
keyEventType_ = new WText(result);
new WBreak(result);
keyEventDescription_ = new WText(result);
return result;
}
开发者ID:913862627,项目名称:wt,代码行数:29,代码来源:EventsDemo.C
示例6: WLineEdit
WFormWidget *UpdatePasswordWidget::createFormWidget(WFormModel::Field field)
{
WFormWidget *result = 0;
if (field == RegistrationModel::LoginNameField) {
result = new WLineEdit();
} else if (field == AuthModel::PasswordField) {
WLineEdit *p = new WLineEdit();
p->setEchoMode(WLineEdit::Password);
result = p;
} else if (field == RegistrationModel::ChoosePasswordField) {
WLineEdit *p = new WLineEdit();
p->setEchoMode(WLineEdit::Password);
p->keyWentUp().connect
(boost::bind(&UpdatePasswordWidget::checkPassword, this));
p->changed().connect
(boost::bind(&UpdatePasswordWidget::checkPassword, this));
result = p;
} else if (field == RegistrationModel::RepeatPasswordField) {
WLineEdit *p = new WLineEdit();
p->setEchoMode(WLineEdit::Password);
p->changed().connect
(boost::bind(&UpdatePasswordWidget::checkPassword2, this));
result = p;
}
return result;
}
开发者ID:Spencerx,项目名称:wt,代码行数:28,代码来源:UpdatePasswordWidget.C
示例7: WContainerWidget
/*void BasePage::addAuthor(){
WContainerWidget *container1 = new WContainerWidget();
Wt::WTemplate *r = new Wt::WTemplate(Wt::WString::tr("addAuthorForm"));
WLineEdit *editName = new WLineEdit(container1);
editName->setPlaceholderText("name");
r->bindWidget("name", editName);
WLineEdit *editYears = new WLineEdit(container1);
editYears->setPlaceholderText("years");
r->bindWidget("years", editYears);
WPushButton *button = new WPushButton("Add author", container1);
button->setMargin(10, Top | Bottom);
button->clicked().connect(std::bind([=] () {BookManager am; am.addAuthor("123","2016"); }));
r->bindWidget("button", button);
_pagecontent->addWidget(r);
}*/
void BasePage::addMark(const Dbo::collection<Dbo::ptr<Book> >& listaddmark){
WTable *table = new WTable();
table->setHeaderCount(1);
table->setStyleClass("tablestyle");
table->elementAt(0, 0)->addWidget(new WText("<p align='left'> # </p>"));
table->elementAt(0, 1)->addWidget(new WText("<p align='left'> Title of book </p>"));
table->elementAt(0, 2)->addWidget(new WText("<p align='left'> Author </p>"));
table->elementAt(0, 3)->addWidget(new WText("<p align='left'> Genre </p>"));
table->elementAt(0, 4)->addWidget(new WText("<p align='left'> Add your mark </p>"));
_pagecontent->addWidget(table);
int row=1;
for (Dbo::collection<Dbo::ptr<Book> >::const_iterator i = listaddmark.begin(); i != listaddmark.end(); ++i){
Dbo::ptr<Book> book = *i;
table->setStyleClass("tablestyle th,td,tr");
//headers
table->elementAt(row, 0)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(row)));
//titles
table->elementAt(row, 1)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg(book.get()->title)));
//authors
table->elementAt(row, 2)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((book.get()->author.get()->name))));
//genres
table->elementAt(row, 3)
->addWidget(new WText(WString::fromUTF8("{1}")
.arg((book.get()->genre.get()->genre))));
//add mark
WLineEdit *editAddMark = new WLineEdit(table->elementAt(row,4));
editAddMark->setPlaceholderText("Add mark");
table->elementAt(row, 4)
->addWidget(editAddMark);
table->elementAt(row, 4)
->addWidget(new WText("<br></br>"));
WPushButton *button = new WPushButton("Add mark", table->elementAt(row,4));
button->setMargin(10, Top | Bottom);
table->elementAt(row, 4)
->addWidget(button);
/*button->clicked().connect(std::bind([] ( Dbo::ptr<Book> book) {
BookManager bm;
std::cout<<book.get()->title;
int curMark=book.get()->mark;
int curNumMarks=book.get()->numMarks;
bm.refreshRate(book.get()->id, curMark+5, curNumMarks+1, session);
},*i ));*/
row++;
_pagecontent->addWidget(table);
}
}
开发者ID:leshkajou,项目名称:bookrate,代码行数:72,代码来源:basepage.cpp
示例8: IndexContainerWidget
WWidget *WItemDelegate::createEditor(const WModelIndex& index,
WFlags<ViewItemRenderFlag> flags) const
{
IndexContainerWidget *const result =
new IndexContainerWidget(index);
result->setSelectable(true);
WLineEdit *lineEdit = new WLineEdit();
lineEdit->setText(asString(index.data(EditRole), textFormat_));
lineEdit->enterPressed().connect
(boost::bind(&WItemDelegate::doCloseEditor, this, result, true));
lineEdit->escapePressed().connect
(boost::bind(&WItemDelegate::doCloseEditor, this, result, false));
lineEdit->escapePressed().preventPropagation();
if (flags & RenderFocused)
lineEdit->setFocus(true);
// We use a layout so that the line edit fills the entire cell.
// Somehow, this does not work with konqueror, but it does respond
// properly to width, height being set to 100% !
WApplication *app = WApplication::instance();
if (app->environment().agent() != WEnvironment::Konqueror) {
result->setLayout(new WHBoxLayout());
result->layout()->setContentsMargins(1, 1, 1, 1);
result->layout()->addWidget(lineEdit);
} else {
lineEdit->resize(WLength(100, WLength::Percentage),
WLength(100, WLength::Percentage));
result->addWidget(lineEdit);
}
return result;
}
开发者ID:Brasil,项目名称:wt,代码行数:34,代码来源:WItemDelegate.C
示例9: 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;
}
开发者ID:913862627,项目名称:wt,代码行数:18,代码来源:AuthWidget.C
示例10: 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); // ???
}
}
开发者ID:NovaWova,项目名称:wt,代码行数:43,代码来源:PasswordPromptDialog.C
示例11: WDialog
PasswordPromptDialog::PasswordPromptDialog(Login& login,
const AbstractPasswordService& auth)
: WDialog(tr("Wt.Auth.enter-password")),
login_(login),
auth_(auth)
{
impl_ = new WTemplate(tr("Wt.Auth.template.password-prompt"));
impl_->addFunction("id", &WTemplate::Functions::id);
impl_->addFunction("tr", &WTemplate::Functions::tr);
WLineEdit *nameEdit
= new WLineEdit(login.user().identity(Identity::LoginName));
nameEdit->disable();
nameEdit->addStyleClass("Wt-disabled");
passwordEdit_ = new WLineEdit();
WText *passwdInfo = new WText();
WPushButton *okButton = new WPushButton(tr("Wt.WMessageBox.Ok"));
WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));
enterPasswordFields_ = new EnterPasswordFields(auth, passwordEdit_,
passwdInfo, okButton, this);
impl_->bindWidget("user-name", nameEdit);
impl_->bindWidget("password", passwordEdit_);
impl_->bindWidget("password-info", passwdInfo);
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("-21em", Left); // .Wt-form width
setMargin("-200px", Top); // ???
}
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:43,代码来源:PasswordPromptDialog.C
示例12: dialog
void AdsEditor::novoAnuncio() {
AdsApplication *app = AdsApplication::adsApplication();
cppdb::session &db = app->db_;
Wt::WDialog dialog("novo Anuncio");
Wt::WPushButton *ok = new WPushButton("Ok");
ok->setStyleClass("btn btn-primary");
ok->clicked().connect(&dialog, &Wt::WDialog::accept);
Wt::WPushButton *cancel = new WPushButton("Cancela");
cancel->setStyleClass("btn");
cancel->clicked().connect(&dialog, &Wt::WDialog::reject);
WLineEdit *lTitulo = new WLineEdit();
WLineEdit *lURL = new WLineEdit();
WLineEdit *lTexto = new WLineEdit();
WTemplate *t = new WTemplate(dialog.contents());
t->setTemplateText("<form>"
" <fieldset>"
" <legend>Dados do anuncio</legend>"
" <table border=0>"
" <tr><td>Titulo</td> <td>${titulo}</td></tr>"
" <tr><td>URL</td> <td>${url}</td></tr>"
" <tr><td>Texto</td> <td>${texto}</td></tr>"
" </table>"
" </fieldset>"
" ${ok}${cancel}"
"</form>"
, XHTMLUnsafeText);
t->bindWidget("titulo", lTitulo);
t->bindWidget("url", lURL);
t->bindWidget("texto", lTexto);
t->bindWidget("ok", ok);
t->bindWidget("cancel", cancel);
if (dialog.exec() == Wt::WDialog::Accepted) {
db << "insert into anuncio (id, titulo, url, texto, imagem) values "
"(NULL, ?,?,?, '/img/cabure.png')"
<< lTitulo->text().narrow() << lURL->text().narrow()
<< lTexto->text().narrow() << cppdb::exec;
}
renderUI();
}
开发者ID:trumae,项目名称:PractWave,代码行数:42,代码来源:AdsEditor.cpp
示例13: WContainerWidget
ChartSettings::ChartSettings(WCartesian3DChart *chart,
WContainerWidget * parent)
: WContainerWidget(parent),
chart_(chart)
{
WTemplate* template_ = new WTemplate(Wt::WString::tr("chartconfig-template"), this);
WCheckBox *autoRangeX_ = new WCheckBox(this);
template_->bindWidget("xAuto", autoRangeX_);
autoRangeX_->setCheckState(Wt::Checked);
chart_->initLayout();
WLineEdit *xMin_ = new WLineEdit
(Wt::asString(chart_->axis(XAxis_3D).minimum()), this);
template_->bindWidget("xAxisMin", xMin_);
xMin_->setValidator(new Wt::WDoubleValidator(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
xMin_->setEnabled(false);
WLineEdit *xMax_ = new WLineEdit
(Wt::asString(chart_->axis(XAxis_3D).maximum()), this);
template_->bindWidget("xAxisMax", xMax_);
xMax_->setValidator(new Wt::WDoubleValidator(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
xMax_->setEnabled(false);
WCheckBox *autoRangeY_ = new WCheckBox(this);
template_->bindWidget("yAuto", autoRangeY_);
autoRangeY_->setCheckState(Wt::Checked);
WLineEdit *yMin_ = new WLineEdit
(Wt::asString(chart_->axis(YAxis_3D).minimum()), this);
template_->bindWidget("yAxisMin", yMin_);
yMin_->setValidator(new Wt::WDoubleValidator(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
yMin_->setEnabled(false);
WLineEdit *yMax_ = new WLineEdit
(Wt::asString(chart_->axis(YAxis_3D).maximum()), this);
template_->bindWidget("yAxisMax", yMax_);
yMax_->setValidator(new Wt::WDoubleValidator(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
yMax_->setEnabled(false);
WCheckBox *autoRangeZ_ = new WCheckBox(this);
template_->bindWidget("zAuto", autoRangeZ_);
autoRangeZ_->setCheckState(Wt::Checked);
WLineEdit *zMin_ = new WLineEdit
(Wt::asString(chart_->axis(ZAxis_3D).minimum()), this);
template_->bindWidget("zAxisMin", zMin_);
zMin_->setValidator(new Wt::WDoubleValidator(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
zMin_->setEnabled(false);
WLineEdit *zMax_ = new WLineEdit
(Wt::asString(chart_->axis(ZAxis_3D).maximum()), this);
template_->bindWidget("zAxisMax", zMax_);
zMax_->setValidator(new Wt::WDoubleValidator(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max()));
zMax_->setEnabled(false);
WLineEdit *title = new WLineEdit(this);
template_->bindWidget("chartTitle", title);
WCheckBox *enableLegend = new WCheckBox(this);
template_->bindWidget("chartLegend", enableLegend);
WComboBox *legendSide = new WComboBox(this);
legendSide->addItem("Left");
legendSide->addItem("Right");
legendSide->addItem("Top");
legendSide->addItem("Bottom");
template_->bindWidget("legendside", legendSide);
switch (chart_->legendSide()) {
case Left:
legendSide->setCurrentIndex(0); break;
case Right:
legendSide->setCurrentIndex(1); break;
case Top:
legendSide->setCurrentIndex(2); break;
case Bottom:
legendSide->setCurrentIndex(3); break;
default:
break;
}
WComboBox *legendAlignment = new WComboBox(this);
legendAlignment->addItem("Left");
legendAlignment->addItem("Center");
legendAlignment->addItem("Right");
legendAlignment->addItem("Top");
legendAlignment->addItem("Middle");
legendAlignment->addItem("Bottom");
template_->bindWidget("legendalignment", legendAlignment);
switch (chart_->legendAlignment()) {
case AlignLeft:
legendAlignment->setCurrentIndex(0); break;
case AlignCenter:
legendAlignment->setCurrentIndex(1); break;
case AlignRight:
legendAlignment->setCurrentIndex(2); break;
case AlignTop:
legendAlignment->setCurrentIndex(3); break;
case AlignMiddle:
legendAlignment->setCurrentIndex(4); break;
case AlignBottom:
legendAlignment->setCurrentIndex(5); break;
default:
break;
}
WCheckBox *enableGridLines = new WCheckBox(this);
template_->bindWidget("gridlines", enableGridLines);
WLineEdit *widgetWidth = new WLineEdit(Wt::asString(chart_->width().value()), this);
widgetWidth->setValidator(new Wt::WIntValidator(1, 2000));
//.........这里部分代码省略.........
开发者ID:DTidd,项目名称:wt,代码行数:101,代码来源:Tabs.C
示例14: 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();
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:86,代码来源:UpdatePasswordWidget.C
示例15: WContainerWidget
void WebGLDemo::main(){
glContainer_ = new WContainerWidget(root());
glContainer_->resize(500, 500);
glContainer_->setInline(false);
root()->addWidget(new WBreak());
root()->addWidget(new WText("Rotate with mouse and zoom with scroll"));
root()->addWidget(new WBreak());
root()->addWidget(new WText(" "));
root()->addWidget(new WBreak());
root()->addWidget(new WText("LIGHT DIRECTION"));
root()->addWidget(new WBreak());
root()->addWidget(new WText("X : "));
lightDirX = new WLineEdit("-1.0",root());
root()->addWidget(new WText(" Y : "));
lightDirY = new WLineEdit("-1.0",root());
root()->addWidget(new WText(" Z : "));
lightDirZ = new WLineEdit("-1.0",root());
root()->addWidget(new WBreak());
root()->addWidget(new WText(" "));
root()->addWidget(new WBreak());
root()->addWidget(new WText("LIGHT COLOR"));
root()->addWidget(new WBreak());
root()->addWidget(new WText("R : "));
lightColR = new WLineEdit("0.8",root());
root()->addWidget(new WText(" G : "));
lightColG = new WLineEdit("0.8",root());
root()->addWidget(new WText(" B : "));
lightColB = new WLineEdit("0.8",root());
root()->addWidget(new WBreak());
root()->addWidget(new WText(" "));
root()->addWidget(new WBreak());
root()->addWidget(new WText("AMBIENT LIGHT COLOR"));
root()->addWidget(new WBreak());
root()->addWidget(new WText("R : "));
ambLightColR = new WLineEdit("0.2",root());
root()->addWidget(new WText(" G : "));
ambLightColG = new WLineEdit("0.2",root());
root()->addWidget(new WText(" B : "));
ambLightColB = new WLineEdit("0.2",root());
lightDirX->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
lightDirY->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
lightDirZ->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
lightColR->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
lightColG->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
lightColB->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
ambLightColR->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
ambLightColG->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
ambLightColB->keyWentUp().connect(this,&WebGLDemo::eventKeyWentUp);
updateShaders();
this->globalKeyWentDown().connect(this,&WebGLDemo::eventKeyWentDown);
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:67,代码来源:lesson11.cpp
示例16: WTemplateFormView
UpdatePasswordWidget::UpdatePasswordWidget(const User& user,
RegistrationModel *registrationModel,
AuthModel *authModel,
WContainerWidget *parent)
: WTemplateFormView(tr("Wt.Auth.template.update-password"), parent),
user_(user),
registrationModel_(registrationModel),
authModel_(authModel)
{
registrationModel_->setValue(RegistrationModel::LoginNameField,
user.identity(Identity::LoginName));
registrationModel_->setReadOnly(RegistrationModel::LoginNameField, true);
if (authModel_->baseAuth()->emailVerificationEnabled()) {
/*
* This is set in the model so that the password checker can take
* into account whether the password is derived from the email
* address.
*/
registrationModel_->setValue(RegistrationModel::EmailField,
WT_USTRING::fromUTF8(user.email() + " "
+ user.unverifiedEmail()));
registrationModel_->setVisible(RegistrationModel::EmailField, false);
}
WPushButton *okButton = new WPushButton(tr("Wt.WMessageBox.Ok"));
WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel"));
if (authModel_) {
authModel_->setValue(AuthModel::LoginNameField,
user.identity(Identity::LoginName));
updateViewField(authModel_, AuthModel::PasswordField);
authModel_->configureThrottling(okButton);
WLineEdit *password = resolve<WLineEdit *>(AuthModel::PasswordField);
password->setFocus();
}
updateView(registrationModel_);
WLineEdit *password = resolve<WLineEdit *>
(RegistrationModel::ChoosePasswordField);
WLineEdit *password2 = resolve<WLineEdit *>
(RegistrationModel::RepeatPasswordField);
WText *password2Info = resolve<WText *>
(RegistrationModel::RepeatPasswordField + std::string("-info"));
registrationModel_->validatePasswordsMatchJS(password,
password2, password2Info);
if (!authModel_)
password->setFocus();
okButton->clicked().connect(this, &UpdatePasswordWidget::doUpdate);
cancelButton->clicked().connect(this, &UpdatePasswordWidget::close);
bindWidget("ok-button", okButton);
bindWidget("cancel-button", cancelButton);
}
开发者ID:Spencerx,项目名称:wt,代码行数:62,代码来源:UpdatePasswordWidget.C
示例17: handleFinish
void handleFinish(DialogCode result)
{
if (result == WDialog::Accepted) {
/*
* Update the model with data from the edit widgets.
*
* You will want to do some validation here...
*
* Note that we directly update the source model to avoid
* problems caused by the dynamic sorting of the proxy model,
* which reorders row numbers, and would cause us to switch to editing
* the wrong data.
*/
WAbstractItemModel *m = model_;
int modelRow = item_.row();
WAbstractProxyModel *proxyModel = dynamic_cast<WAbstractProxyModel *>(m);
if (proxyModel) {
m = proxyModel->sourceModel();
modelRow = proxyModel->mapToSource(item_).row();
}
m->setData(modelRow, 1, boost::any(nameEdit_->text()));
m->setData(modelRow, 2, boost::any(typeEdit_->currentText()));
m->setData(modelRow, 3, boost::any(boost::lexical_cast<int>
(sizeEdit_->text().toUTF8())));
m->setData(modelRow, 4, boost::any(createdPicker_->date()));
m->setData(modelRow, 5, boost::any(modifiedPicker_->date()));
}
delete this;
}
开发者ID:USP,项目名称:wtcpp,代码行数:32,代码来源:TreeViewDragDrop.C
示例18: run_alg
void HelloApplication::run_alg()
{
sim_params params;
params.pop_size = WLocale::currentLocale().toInt(pop_size_edit->text());
params.num_epochs = WLocale::currentLocale().toInt(num_epochs_edit->text());
enableUpdates(true); // TODO: Right place? And where to disable?
ga_thread.swap(boost::shared_ptr< boost::thread >(new boost::thread(run_fn, this, db_cp, params)));//sessionId())));
}
开发者ID:kamrann,项目名称:workbase,代码行数:9,代码来源:webinterface.cpp
示例19: enterdata
void MyApp::enterdata()
{
{
dbo::Transaction transaction(session);
Ball *blog = new Ball();
blog->username = usernameedit->text().toUTF8();
blog->password = passwordedit->text().toUTF8();
dbo::ptr<Ball> blogPtr = session.add(blog);
transaction.commit();
}}
开发者ID:shaina7837,项目名称:Wt-Blog-code,代码行数:13,代码来源:register.cpp
示例20: loadGitModel
/*! \brief Change repository and/or revision
*/
void loadGitModel() {
sourceView_->setIndex(WModelIndex());
repositoryError_->setText("");
revisionError_->setText("");
try {
gitModel_->setRepositoryPath(repositoryEdit_->text().toUTF8());
try {
gitModel_->loadRevision(revisionEdit_->text().toUTF8());
} catch (const Git::Exception& e) {
revisionError_->setText(e.what());
}
} catch (const Git::Exception& e) {
repositoryError_->setText(e.what());
}
}
开发者ID:AlexanderKotliar,项目名称:wt,代码行数:17,代码来源:GitView.C
注:本文中的WLineEdit类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论