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


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

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


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

示例1: s

Upload::Upload( Wt::WContainerWidget* pcw ) {
  
  //Wt::WContainerWidget *container = new Wt::WContainerWidget();

  Wt::WFileUpload *fu = new Wt::WFileUpload( pcw );
  fu->setFileTextSize( 10000 ); // Set the maximum file size (in KB )
  fu->setProgressBar(new Wt::WProgressBar());
  fu->setMargin(10, Wt::Right);

  // Provide a button to start uploading.
  Wt::WPushButton *uploadButton = new Wt::WPushButton("Send", pcw );
  uploadButton->setMargin(10, Wt::Left | Wt::Right);

  Wt::WText *out = new Wt::WText( pcw );

  // Upload when the button is clicked.
  uploadButton->clicked().connect(std::bind([=] () {
      fu->upload();
      uploadButton->disable();
  }));

  // Upload automatically when the user entered a file.
  fu->changed().connect(std::bind([=] () {
      fu->upload();
      uploadButton->disable();
      std::string s( "File upload is changed." );
      out->setText( s );
  }));

  // React to a succesfull upload.
  fu->uploaded().connect(std::bind([=] () {
    std::string s( "File upload is finished: " );
    s += fu->clientFileName().toUTF8();
    s += ",";
    //s += fu->fileTextSize()
    s += fu->spoolFileName();
    //fu->stealSpooledFile()
    out->setText( s );
  }));

  // React to a file upload problem.
  fu->fileTooLarge().connect(std::bind([=] () {
      out->setText("File is too large.");
  }));
}
开发者ID:rburkholder,项目名称:nodestar,代码行数:45,代码来源:Upload.cpp

示例2: setTitle

EarMobileUI::EarMobileUI(const Wt::WEnvironment& env)
  : Wt::WApplication(env)
{
    setTitle("Ear Mobile interface"); 
this->log("notice")<<"Making mobile UI";
    Wt::WBootstrapTheme *theme = new Wt::WBootstrapTheme();
///    theme->setResponsive(true);
    theme->setVersion(Wt::WBootstrapTheme::Version3); 
   // this->removeMetaHeader(Wt::MetaHeaderType::MetaName,"viewport");
    //this->addMetaHeader("viewport",
//			   "width=device-width, height=device-height, initial-scale=2");
//  this->addMetaHeader("viewport",
//			   "width=1024");
  setTheme(theme);
   

Wt::WTemplate *html = new Wt::WTemplate(Wt::WString(
"<div width='device-width' scale='4'   >"
	"<div>"
		"${start-button} ${stop-button} ${play-time}"
	"</div>"
	"<div>"
		"${fragment-tree}"
	"</div>"
"</div>"
),root());

 
this->log("notice")<<"Making button container";
    //Wt::WContainerWidget *buttonContainer = new Wt::WContainerWidget(root());
    //buttonContainer->setMaximumSize(500,Wt::WLength::Auto);
    //Wt::WHBoxLayout *buttonBox = new Wt::WHBoxLayout();
    //buttonContainer->setLayout(buttonBox);
    playPauseButton = new Wt::WPushButton("Play from start");
    //buttonBox->addWidget(playPauseButton);
    playPauseButton->clicked().connect(std::bind([=] ()
    {
this->log("notice")<<"interactnig to pause";
	zmq_conn::interact(std::string("event:pause"));
    }));
    html->bindWidget("start-button",playPauseButton);
    Wt::WPushButton *stopButton = new Wt::WPushButton("Stop"); 
    //buttonBox->addWidget(stopButton);
    html->bindWidget("stop-button",stopButton);

    stopButton->clicked().connect(std::bind([=] ()
    {
this->log("notice")<<"interactnig to stop";
	zmq_conn::interact(std::string("event:stop"));
    }));
    stopButton->setMargin(5, Wt::Left);
    posText = new TimeWidget();
    posText->setMargin(5, Wt::Left);
    html->bindWidget("play-time",posText);
    //buttonBox->addWidget(posText);
   


//    Wt::WContainerWidget *fragmentContainer = new Wt::WContainerWidget(root());
    fragmentTree = new Wt::WTreeTable();
 html->bindWidget("fragment-tree",fragmentTree);
//    fragmentTree->addColumn("",500);
//    fragmentTree->resize(
//			Wt::WLength(100,Wt::WLength::Unit::Percentage), //Width
//			Wt::WLength(80,Wt::WLength::Unit::Percentage)); //Heigth
/*   Wt::WTimer *inputtimer = new Wt::WTimer();   
   inputtimer->setInterval(2500); //For some reason, this actually segfaults (on a RPi) when it fires, before calling updateInputs. Calling updateInputs from any other place works, including the other timer. I'll try and find out the cause later, now it runs
   inputtimer->timeout().connect(std::bind([=] ()
   {
std::cout<< "updating inputs " <<std::endl;
       updateInputs();
   }));
   inputtimer->start();
*/

   updateInputs();


    Wt::WTimer *timer = new Wt::WTimer();  
    timer->setInterval(100);
    timer->timeout().connect(std::bind([=] ()
    {
	Wt::Json::Object posj ;
	bool playing;
	Wt::Json::Object playingj;

	zmq::socket_t *socket = zmq_conn::connect();
	posj = zmq_conn::interact(std::string("pos?"),socket);
	playingj = zmq_conn::interact(std::string("playing?"),socket);
	zmq_conn::disconnect(socket);

	Wt::Json::Value posjv = posj.get("pos");	
	const long long track_time = posjv;
	posText->setTime(track_time);
	mark_current_fragment(fragmentTree,track_time);
	playing = playingj.get("playing");
	if (playing)
	{
		playPauseButton->setText("Pause");
	}
//.........这里部分代码省略.........
开发者ID:wijnen,项目名称:ear,代码行数:101,代码来源:earMobileUI.C

示例3: _initialize

void ChamadaForm::_initialize(){
	Wt::Dbo::Transaction transaction(_dbSession);

	Wt::WText* title = new Wt::WText("<h3>Diario de Classe: " + Wt::WDate::currentDate().toString("dd/MM/yyyy").toUTF8() + "</h3> <br></br><br></br>");

		addWidget(title);
		Wt::WPushButton* fazerChamada = new Wt::WPushButton("Percorrer turma", this);

		fazerChamada->setStyleClass("btn btn-primary");

		fazerChamada->clicked().connect(std::bind([=](){
			new AutoChamada(_dbSession, sortList);
		}));

		fazerChamada->setMargin(20, Wt::Bottom);
		_list =  new Wt::WTable(this);


		Wt::WPushButton* save = new Wt::WPushButton("Salvar", this);
		save->setStyleClass("btn btn-success");
		save->setMargin(10, Wt::Right);
		save->clicked().connect(std::bind([=](){
			_save();
			delete this;
		}));

		Wt::WPushButton* cancel = new Wt::WPushButton("Cancelar", this);
		cancel->setStyleClass("btn btn-primary");
		cancel->clicked().connect(std::bind([=](){
			delete this;
		}));

	_list->setWidth(Wt::WLength("100%"));
	_list->addStyleClass("table-striped table-hover");
	_list->setMargin(50, Wt::Bottom);
	new Wt::WText("Aluno", _list->elementAt(0,0));
	new Wt::WText("Presente", _list->elementAt(0,1));
	_list->setHeaderCount(1);


	for(auto i : _disciplina->turma()->alunos()){
		Wt::WCheckBox* checkbox = new Wt::WCheckBox();
		sortList.push_back(std::make_pair(checkbox, i));
	}

	auto sortAlg = [](std::pair<Wt::WCheckBox*, Wt::Dbo::ptr<SiconfModel::Aluno>> par1, std::pair<Wt::WCheckBox*, Wt::Dbo::ptr<SiconfModel::Aluno>>par2){
		return par1.second->usuario()->nome() < par2.second->usuario()->nome();
	};

	std::sort(std::begin(sortList), std::end(sortList), sortAlg);

	for(auto i : sortList){
		int row = _list->rowCount();
		Wt::WText* name = new Wt::WText(i.second->usuario()->nome() + " " + i.second->usuario()->sobrenome(), _list->elementAt(row, 0));
		name->setMargin(10, Wt::Right);
		_list->elementAt(row, 1)->addWidget(i.first);
		_list->elementAt(row, 1)->setHeight(40);
		_list->elementAt(row, 1)->setWidth(100);

	}
}
开发者ID:MichaelSantosSim,项目名称:Siconf,代码行数:61,代码来源:ChamadaForm.cpp


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