本文整理汇总了C++中wt::WPushButton::setMenu方法的典型用法代码示例。如果您正苦于以下问题:C++ WPushButton::setMenu方法的具体用法?C++ WPushButton::setMenu怎么用?C++ WPushButton::setMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wt::WPushButton
的用法示例。
在下文中一共展示了WPushButton::setMenu方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
void studentPasswords::create() {
Wt::WPanel * panel = new Wt::WPanel(this);
panel->setStyleClass("panel panel-primary");
panel->setTitle("<h3>Wachtwoorden Administratie</h3>");
panel->setMinimumSize(800, 800);
panel->setMaximumSize(800, Wt::WLength::Auto);
panel->setMargin("0 auto");
Wt::WContainerWidget * content = new Wt::WContainerWidget();
panel->setCentralWidget(content);
content->setPadding("1%");
buttons = new Wt::WContainerWidget(content);
Wt::WHBoxLayout * buttonLayout = new Wt::WHBoxLayout();
buttons->setLayout(buttonLayout);
Wt::WPopupMenu * popup = new Wt::WPopupMenu();
Wt::WPushButton * button = new Wt::WPushButton();
button->setMenu(popup);
button->setText("Selecteer een klas");
buttonLayout->addWidget(button);
Wt::WPushButton * button2 = new Wt::WPushButton();
button2->setText("Selectie Aanpassen");
button2->setStyleClass("btn btn-success");
buttonLayout->addWidget(button2);
button2->clicked().connect(this, &studentPasswords::changePasswords);
Wt::WContainerWidget * tableContent = new Wt::WContainerWidget(content);
table = new Wt::WTable(tableContent);
// add classes
Wt::WPopupMenu * subMenu[7];
for(int i = 0; i < 7; i++) {
subMenu[i] = new Wt::WPopupMenu();
if(i == 0) {
popup->addMenu("1ste jaar", subMenu[i]);
} else {
string s = string(i+1) + "de jaar";
popup->addMenu(s.wt(), subMenu[i]);
}
}
CLASSES & classes = server->getClasses();
for(int i = 0; i < classes.elms(); i++) {
string name = classes[i].cn().get();
if(name.empty()) continue;
int year = -1;
switch(name[0]) {
case '1': year = 0; break;
case '2': year = 1; break;
case '3': year = 2; break;
case '4': year = 3; break;
case '5': year = 4; break;
case '6': year = 5; break;
case '7': year = 6; break;
}
if(year < 0) continue;
subMenu[year]->addItem(name.wt())->triggered().connect(std::bind([=] () {
showClass(name);
}));
}
progress = new Wt::WProgressBar(content);
progress->hide();
anchor = new Wt::WAnchor(Wt::WLink(&pfile), "Download passwords", content);
anchor->setTarget(Wt::TargetNewWindow);
anchor->clicked().connect(this, &studentPasswords::reset);
anchor->hide();
}