当前位置: 首页>>代码示例>>C++>>正文


C++ WLineEdit类代码示例

本文整理汇总了C++中WLineEdit的典型用法代码示例。如果您正苦于以下问题:C++ WLineEdit类的具体用法?C++ WLineEdit怎么用?C++ WLineEdit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WLineEdit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例14: 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

示例15: 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


注:本文中的WLineEdit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。