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


C++ WPushButton::clicked方法代码示例

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


在下文中一共展示了WPushButton::clicked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DialogButtonBar

 DialogButtonBar(WDialog& dialog) : MoreAwesomeTemplate(dialog.contents()) {
     setTemplateText(tr("dialog-button-bar"));
     bindAndCreateWidget(_okBtn, "ok-btn", tr("ok-btn"));
     bindAndCreateWidget(_cancelBtn, "cancel-btn", tr("cancel-btn"));
     _okBtn->clicked().connect(&dialog, &WDialog::accept);
     _cancelBtn->clicked().connect(&dialog, &WDialog::reject);
 }
开发者ID:aadarshasubedi,项目名称:vidanueva,代码行数:7,代码来源:DialogButtonBar.hpp

示例2: WText

WApplication *createApplication(const WEnvironment& env)
{
  WApplication *appl = new WApplication(env);

  new WText("<h1>Your mission</h1>", appl->root());
  WText *secret 
    = new WText("Your mission, Jim, should you accept, is to create solid "
		"web applications.",
		appl->root());

  new WBreak(appl->root()); new WBreak(appl->root());

  new WText("This program will quit in ", appl->root());
  CountDownWidget *countdown = new CountDownWidget(10, 0, 1000, appl->root());
  new WText(" seconds.", appl->root());

  new WBreak(appl->root()); new WBreak(appl->root());

  WPushButton *cancelButton = new WPushButton("Cancel!", appl->root());
  WPushButton *quitButton = new WPushButton("Quit", appl->root());
  quitButton->clicked().connect(appl, &WApplication::quit);

  countdown->done().connect(appl, &WApplication::quit);
  cancelButton->clicked().connect(countdown, &CountDownWidget::cancel);
  cancelButton->clicked().connect(cancelButton, &WFormWidget::disable);
  cancelButton->clicked().connect(secret, &WWidget::hide);

  return appl;
}
开发者ID:913862627,项目名称:wt,代码行数:29,代码来源:impossible.C

示例3: WApplication

WebGLDemo::WebGLDemo(const WEnvironment& env)
  : WApplication(env)
{
  setTitle("WebGL Demo");

  root()->addWidget(new WText("If your browser supports WebGL, you'll "
    "see a teapot below.<br/>Use your mouse to move around the teapot.<br/>"
    "Edit the shaders below the teapot to change how the teapot is rendered."));
  root()->addWidget(new WBreak());

  paintWidget_ = 0;

  glContainer_ = new WContainerWidget(root());
  glContainer_->resize(500, 500);
  glContainer_->setInline(false);

  WPushButton *updateButton = new WPushButton("Update shaders", root());
  updateButton->clicked().connect(this, &WebGLDemo::updateShaders);
  WPushButton *resetButton = new WPushButton("Reset shaders", root());
  resetButton->clicked().connect(this, &WebGLDemo::resetShaders);

  WTabWidget *tabs = new WTabWidget(root());

  fragmentShaderText_ = new WTextArea;
  fragmentShaderText_->resize(750, 250);
  tabs->addTab(fragmentShaderText_, "Fragment Shader");
  WText *shaderInfo = new WText(root());
  vertexShaderText_ = new WTextArea;
  vertexShaderText_->resize(750, 250);
  tabs->addTab(vertexShaderText_, "Vertex Shader");

  resetShaders();
}
开发者ID:913862627,项目名称:wt,代码行数:33,代码来源:teapot.C

示例4: SimpleChatWidget

ChatApplication::ChatApplication(const WEnvironment& env,
				 SimpleChatServer& server)
  : WApplication(env),
    server_(server),
    env_(env)
{
  setTitle("Wt Chat");
  useStyleSheet("chatapp.css");

  messageResourceBundle().use(appRoot() + "simplechat");

  javaScriptTest();

  root()->addWidget(new WText(WString::tr("introduction")));

  SimpleChatWidget *chatWidget =
      new SimpleChatWidget(server_, root());
  chatWidget->setStyleClass("chat");

  root()->addWidget(new WText(WString::tr("details")));

  WPushButton *b = new WPushButton("I'm schizophrenic ...", root());
  b->clicked().connect(b, &WPushButton::hide);
  b->clicked().connect(this, &ChatApplication::addChatWidget);
}
开发者ID:913862627,项目名称:wt,代码行数:25,代码来源:simpleChat.C

示例5: WText

TreeViewExample::TreeViewExample(WStandardItemModel *model,
				 const WString& titleText)
  : model_(model)
{
  belgium_ = model_->item(0, 0)->child(0, 0);

  new WText(titleText, this);

  /*
   * Now create the view
   */
  WPanel *panel = new WPanel(this);
  panel->resize(600, 300);
  panel->setCentralWidget(treeView_ = new WTreeView());
  if (!WApplication::instance()->environment().ajax())
    treeView_->resize(WLength::Auto, 290);

  treeView_->setAlternatingRowColors(true);
  treeView_->setRowHeight(25);
  treeView_->setModel(model_);

  treeView_->setColumnWidth(1, WLength(100));
  treeView_->setColumnAlignment(1, AlignCenter);
  treeView_->setColumnWidth(3, WLength(100));
  treeView_->setColumnAlignment(3, AlignCenter);

  /*
  treeView_->setRowHeaderCount(1);
  treeView_->setColumnWidth(0, 300);
  */

  /*
   * Expand the first (and single) top level node
   */
  treeView_->setExpanded(model->index(0, 0), true);
  treeView_->setExpanded(model->index(0, 0, model->index(0, 0)), true);

  /*
   * Setup some buttons to manipulate the view and the model.
   */
  WContainerWidget *wc = new WContainerWidget(this);
  WPushButton *b;
  
  b = new WPushButton("Toggle row height", wc);
  b->clicked().connect(this, &TreeViewExample::toggleRowHeight);
  b->setToolTip("Toggles row height between 31px and 25px");
  
  b = new WPushButton("Toggle stripes", wc);
  b->clicked().connect(this, &TreeViewExample::toggleStripes);
  b->setToolTip("Toggle alternating row colors");
  
  b = new WPushButton("Toggle root", wc);
  b->clicked().connect(this, &TreeViewExample::toggleRoot);
  b->setToolTip("Toggles root item between all and the first continent.");

  b = new WPushButton("Add rows", wc);
  b->clicked().connect(this, &TreeViewExample::addRows);
  b->setToolTip("Adds some cities to Belgium");
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:59,代码来源:TreeViewExample.C

示例6: WText

JavascriptExample::JavascriptExample(const WEnvironment& env)
  : WApplication(env)
{
  setTitle("Javascript example");

  // Create a popup for prompting the amount of money, and connect the
  // okPressed button to the slot for setting the amount of money.
  //
  // Note that the input provided by the user in the prompt box is passed as
  // an argument to the slot.
  promptAmount_ = Popup::createPrompt("How much do you want to pay?", "",
				      this);
  promptAmount_->okPressed().connect(this, &JavascriptExample::setAmount);

  // Create a popup for confirming the payment.
  //
  // Since a confirm popup does not allow input, we ignore the
  // argument carrying the input (which will be empty anyway).
  confirmPay_ = Popup::createConfirm("", this);
  confirmPay_->okPressed().connect(this, &JavascriptExample::confirmed);

  new WText("<h2>Wt Javascript example</h2>"
	    "<p>Wt makes abstraction of Javascript, and therefore allows you"
	    " to develop web applications without any knowledge of Javascript,"
	    " and which are not dependent on Javascript."
	    " However, Wt does allow you to add custom Javascript code:</p>"
	    " <ul>"
	    "   <li>To call custom JavaScript code from an event handler, "
	    "connect the Wt::EventSignal to a Wt::JSlot.</li>"
	    "   <li>To call C++ code from custom JavaScript, use "
	    "Wt.emit() to emit a Wt::JSignal.</li>"
	    "   <li>To call custom JavaScript code from C++, use "
	    "WApplication::doJavascript() or Wt::JSlot::exec().</li>"
	    " </ul>"
	    "<p>This simple application shows how to interact between C++ and"
	    " JavaScript using the JSlot and JSignal classes.</p>", root());

  currentAmount_
    = new WText("Current amount: $" + promptAmount_->defaultValue(), root());

  WPushButton *amountButton = new WPushButton("Change ...", root());
  amountButton->setMargin(10, Left | Right);

  new WBreak(root());

  WPushButton *confirmButton = new WPushButton("Pay now.", root());
  confirmButton->setMargin(10, Top | Bottom);

  // Connect the event handlers to a JSlot: this will execute the JavaScript
  // immediately, without a server round trip.
  amountButton->clicked().connect(promptAmount_->show);
  confirmButton->clicked().connect(confirmPay_->show);

  // Set the initial amount
  setAmount("1000");
}
开发者ID:913862627,项目名称:wt,代码行数:56,代码来源:JavascriptExample.C

示例7: WText

DialogExample::DialogExample(const WEnvironment& env)
  : WApplication(env),
    messageBox_(0)
{
  setTitle("Dialog example");

  WContainerWidget *textdiv = new WContainerWidget(root());
  textdiv->setStyleClass("text");

  new WText("<h2>Wt dialogs example</h2>", textdiv);
  new WText("You can use WMessageBox for simple modal dialog boxes. <br />",
	    textdiv);

  WContainerWidget *buttons = new WContainerWidget(root());
  buttons->setStyleClass("buttons");

  WPushButton *button;

  button = new WPushButton("One liner", buttons);
  button->clicked().connect(this, &DialogExample::messageBox1);

  button = new WPushButton("Comfortable ?", buttons);
  button->clicked().connect(this, &DialogExample::messageBox2);

  button = new WPushButton("Havoc!", buttons);
  button->clicked().connect(this, &DialogExample::messageBox3);

  button = new WPushButton("Discard", buttons);
  button->clicked().connect(this, &DialogExample::messageBox4);

  button = new WPushButton("Familiar", buttons);
  button->clicked().connect(this, &DialogExample::custom);

  textdiv = new WContainerWidget(root());
  textdiv->setStyleClass("text");

  status_ = new WText("Go ahead...", textdiv);

  styleSheet().addRule(".buttons",
		       "padding: 5px;");
  styleSheet().addRule(".buttons BUTTON",
		       "padding-left: 4px; padding-right: 4px;"
		       "margin-top: 4px; display: block");

  // avoid scrollbar problems
  styleSheet().addRule(".text", "padding: 4px 8px");
  styleSheet().addRule("body", "margin: 0px;");
}
开发者ID:Spencerx,项目名称:wt,代码行数:48,代码来源:DialogExample.C

示例8: WContainerWidget

WWidget *MvcWidgets::viewsCombo()
{
  WContainerWidget *result = new WContainerWidget();

  // WComboBox
#if !defined(WT_TARGET_JAVA)
  topic("WComboBox", "WSelectionBox", "Ext::ComboBox", result);
#else
  topic("WComboBox", "WSelectionBox", result);
#endif
  addText(tr("mvc-stringlistviews"), result);
  addText("<h3>WComboBox</h3>", result);
  (new WComboBox(result))->setModel(stringList_);

  // WSelectionBox
  addText("<h3>WSelectionBox</h3>", result);
  (new WSelectionBox(result))->setModel(stringList_);

#ifndef WT_TARGET_JAVA
  // Ext::ComboBox
  addText("<h3>Ext::ComboBox</h3>", result);
  extComboBox_ = new Ext::ComboBox(result);
  extComboBox_->setModel(stringList_);
  extComboBox_->setEditable(true);
  WPushButton *pb = new WPushButton("Press here to add the edited value "
				    "to the model", result);
  pb->clicked().connect(this, &MvcWidgets::comboBoxAdd);
#endif
  
  return result;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:31,代码来源:MvcWidgets.C

示例9: WApplication

HelloApplication::HelloApplication(const WEnvironment& env)
      : WApplication(env)
{
      setTitle("Hello world");                               // application title

        root()->addWidget(new WText("Your name, please ? "));  // show some text
          nameEdit_ = new WLineEdit(root());                     // allow text input
            nameEdit_->setFocus();                                 // give focus

              WPushButton *b = new WPushButton("Greet me.", root()); // create a button
                b->setMargin(5, Left);                        // add 5 pixels margin 

                  root()->addWidget(new WBreak());                       // insert a line break

                    greeting_ = new WText(root());                         // empty text
  /*
   * Connect signals with slots
   *
   * - simple Wt-way
   */
  b->clicked().connect(this, &HelloApplication::greet);

  /*
   * - using an arbitrary function object (binding values with boost::bind())
   */
  nameEdit_->enterPressed().connect
    (boost::bind(&HelloApplication::greet, this));

  /*
   * - using a c++0x lambda:
   */
  // b->clicked().connect(std::bind([=]() { 
  //       greeting_->setText("Hello there, " + nameEdit_->text());
  // }));
}
开发者ID:lyase,项目名称:cblog,代码行数:35,代码来源:main.cpp

示例10: letLogin

void SimpleChatWidget::letLogin()
{
  disconnect();

  clear();

  WVBoxLayout *vLayout = new WVBoxLayout();
  setLayout(vLayout, AlignLeft | AlignTop);

  WHBoxLayout *hLayout = new WHBoxLayout();
  vLayout->addLayout(hLayout);

  hLayout->addWidget(new WLabel("User name:"), 0, AlignMiddle);
  hLayout->addWidget(userNameEdit_ = new WLineEdit(user_), 0, AlignMiddle);
  userNameEdit_->setFocus();

  WPushButton *b = new WPushButton("Login");
  hLayout->addWidget(b, 0, AlignMiddle);

  b->clicked().connect(this, &SimpleChatWidget::login);
  userNameEdit_->enterPressed().connect(this, &SimpleChatWidget::login);

  vLayout->addWidget(statusMsg_ = new WText());
  statusMsg_->setTextFormat(PlainText);
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:25,代码来源:SimpleChatWidget.C

示例11: revengeProposed

void menuWidget::revengeProposed()
{
    WApplication *app = WApplication::instance();
    information->setText("Revenge was proposed. Press start to begin");
    startGame->enable();
    revenge->disable();
    giveUp->disable();
    endGame->enable();
    gameButtons.clear();
    everything->clear();
    delete everything;
    everything = new WTable(this);
    for(int i = 0; i<SIZE; i++)
    {
        for(int j = 0; j<SIZE; j++) {
            WPushButton * newButton = new WPushButton();
            newButton->disable();
            newButton->resize(35,35); //images are 30x30, just in case
            newButton->setVerticalAlignment(Wt::AlignMiddle);
            newButton->clicked().connect(boost::bind(&menuWidget::processClickButton,this,newButton,i,j));
            everything->elementAt(i,j)->addWidget(newButton);
            gameButtons.insert(make_pair(Coordinates(j,i),newButton));
        }//adding the noughts&crosses buttons (225)
    }

    app->triggerUpdate();
}
开发者ID:micp,项目名称:ZPR,代码行数:27,代码来源:menuWidget.cpp

示例12: WPushButton

WPushButton *WMessageBox::addButton(const WString& text, StandardButton result)
{
  WPushButton *b = new WPushButton(text, buttonContainer_);
  buttonMapper_->mapConnect(b->clicked(), result);

  return b;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:7,代码来源:WMessageBox.C

示例13: bindPanelTemplates

  void bindPanelTemplates() {
    if (!session_.user())
      return;

    dbo::Transaction t(session_);

    if (authorPanel_) {
      WPushButton *newPost = new WPushButton(tr("new-post"));
      newPost->clicked().connect(SLOT(this, BlogImpl::newPost));
      WContainerWidget *unpublishedPosts = new WContainerWidget();
      showPosts(session_.user()->allPosts(Post::Unpublished), unpublishedPosts);

      authorPanel_->bindString("user", session_.user()->name);
      authorPanel_->bindInt("unpublished-count",
			    (int)session_.user()->allPosts(Post::Unpublished)
			    .size());
      authorPanel_->bindInt("published-count",
			    (int)session_.user()->allPosts(Post::Published)
			    .size());
      authorPanel_->bindWidget("new-post", newPost);
      authorPanel_->bindWidget("unpublished-posts", unpublishedPosts);
    }

    t.commit();
  }
开发者ID:DTidd,项目名称:wt,代码行数:25,代码来源:BlogView.C

示例14: addBook

void BasePage::addBook(){
	WContainerWidget *container = new WContainerWidget();
	Wt::WTemplate *t = new Wt::WTemplate(Wt::WString::tr("addBookForm"));
	
	WLineEdit *editTitle = new WLineEdit(container);
	editTitle->setPlaceholderText("title");
	t->bindWidget("title", editTitle);
	
	WLineEdit *editAuthor = new WLineEdit(container);
	editAuthor->setPlaceholderText("author");
	t->bindWidget("author", editAuthor);
	
	WLineEdit *editAuthorYears = new WLineEdit(container);
	editAuthorYears->setPlaceholderText("years of life");
	t->bindWidget("years", editAuthorYears);
	
	WLineEdit *editGenre = new WLineEdit(container);
	editGenre->setPlaceholderText("genre");
	t->bindWidget("genre", editGenre);
	
	WLineEdit *editYear = new WLineEdit(container);
	editYear->setPlaceholderText("year");
	t->bindWidget("year", editYear);
	
	WLineEdit *editSeria = new WLineEdit(container);
	editSeria->setPlaceholderText("seria");
	t->bindWidget("seria", editSeria);
	
	WLineEdit *editNumOfBooks = new WLineEdit(container);
	editNumOfBooks->setPlaceholderText("num of books");
	t->bindWidget("numOfBooks", editNumOfBooks);
	
	WLineEdit *editNumInSeria = new WLineEdit(container);
	editNumInSeria->setPlaceholderText("number in seria");
	t->bindWidget("numInSeria", editNumInSeria);
	
	WLineEdit *editMark = new WLineEdit(container);
	editMark->setPlaceholderText("mark");
	editMark->setValidator(new Wt::WIntValidator(1, 10));
	t->bindWidget("mark", editMark);
	
	WPushButton *button = new WPushButton("Add book", container);
	button->setMargin(10, Top | Bottom);

	button->clicked().connect(std::bind([=] () {BookManager bm; bm.addBook(editTitle->valueText().toUTF8(),
																		   editAuthor->valueText().toUTF8(),
																		   editAuthorYears->valueText().toUTF8(),
																		   editGenre->valueText().toUTF8(),
																		   intoInt(editYear),
																		   editSeria->valueText().toUTF8(),
																		   intoInt(editNumOfBooks),
																		   intoInt(editNumInSeria),
																		   intoInt(editMark)); }));
	
	t->bindWidget("button", button);
	_pagecontent->addWidget(t);	
}
开发者ID:leshkajou,项目名称:bookrate,代码行数:57,代码来源:basepage.cpp

示例15: createUi

void Reports::createUi()
{

    WContainerWidget *dateSelectForm = new WContainerWidget(this);
    dateSelectForm ->setStyleClass("form-inline");
    dateSelectForm ->setId("dateselectform");

    WLabel *label;

    label = new WLabel(tr("reports.begindate"), dateSelectForm );
    m_pBeginDateEdit = new WDateEdit(dateSelectForm );
    //label->setBuddy(m_pBeginDateEdit->lineEdit());
    label->setBuddy(m_pBeginDateEdit);


    //m_pBeginDateEdit->setBottom(WDate(WDate::currentDate().year(), WDate::currentDate().month(), 1));
    m_pBeginDateEdit->setFormat("dd.MM.yyyy");
    m_pBeginDateEdit->setDate(WDate(WDate::currentDate().year(), WDate::currentDate().month(), 1));
    m_pBeginDateEdit->setTop(WDate::currentDate());
    //m_pBeginDateEdit->lineEdit()->validator()->setMandatory(true);
    m_pBeginDateEdit->validator()->setMandatory(true);
    m_pBeginDateEdit->setStyleClass("input-medium");
    //m_pBeginDateEdit->setWidth(120);


    label = new WLabel(tr("reports.enddate"), dateSelectForm );
    m_pEndDateEdit = new WDateEdit(dateSelectForm );
    //label->setBuddy(m_pEndDateEdit->lineEdit());
    label->setBuddy(m_pEndDateEdit);
    //m_pEndDateEdit->setBottom(WDate::currentDate());
    m_pEndDateEdit->setFormat("dd.MM.yyyy");
    m_pEndDateEdit->setDate(WDate::currentDate());
    m_pEndDateEdit->setTop(WDate::currentDate());
    //m_pEndDateEdit->lineEdit()->validator()->setMandatory(true);
    m_pEndDateEdit->validator()->setMandatory(true);
    m_pEndDateEdit->setStyleClass("input-medium");

    /*
    WContainerWidget *corner_kick = new WContainerWidget(dateSelectForm );
    corner_kick->setStyleClass("corner_kick get_filter");
    WTemplate *button = new WTemplate("<ins class=\"i1\"></ins><ins class=\"i2\"></ins><ins class=\"i3\"></ins><ins class=\"i4\"></ins>${anchor}",corner_kick);
    LineEdit *submitBtn = new LineEdit(0,LineEdit::Submit);
    submitBtn->setValueText(tr("reports.filtered"));
    submitBtn->clicked().connect(boost::bind(&Reports::changed, this, submitBtn));
    button->bindWidget("anchor",submitBtn);
    */

    //WTemplate *button = new WTemplate("<ins class=\"i1\"></ins><ins class=\"i2\"></ins><ins class=\"i3\"></ins><ins class=\"i4\"></ins>${anchor}",dateSelectForm);
    WPushButton *anchor = new WPushButton(tr("reports.filtered"),dateSelectForm);
    anchor->clicked().connect(boost::bind(&Reports::changed, this, dateSelectForm));
    //button->bindWidget("anchor",anchor);
    //button->setStyleClass("corner_kick get_filter");


    //(new WLabel(tr("reports.filtered"), corner_kick))->setBuddy(new LineEdit(corner_kick,LineEdit::Submit));

}
开发者ID:ineron,项目名称:fit-zakaz-portal,代码行数:57,代码来源:Reports.cpp


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