本文整理汇总了C++中MenuBar::addAction方法的典型用法代码示例。如果您正苦于以下问题:C++ MenuBar::addAction方法的具体用法?C++ MenuBar::addAction怎么用?C++ MenuBar::addAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuBar
的用法示例。
在下文中一共展示了MenuBar::addAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeWidget
void DClusterUserHasDevicesListPage::initializeWidget()
{
//导航栏
QString strLeftBtn = tr("上一步");
QString strTitle = tr("成员所属设备");
navigationMenuBar = new NavigationMenuBar(this);
navigationMenuBar->setLeftText(strLeftBtn);
navigationMenuBar->setTitleText(strTitle);
connect(navigationMenuBar, SIGNAL(leftClicked()), this, SLOT(on_btnPrepage_clicked()));
MenuBar* menuBar = navigationMenuBar->getMenuBar();
addDeviceAction = menuBar->addAction(tr("添加设备"));
deleteDeviceAction = menuBar->addAction(tr("删除设备"));
connect(addDeviceAction, SIGNAL(triggered()),this,SLOT(on_addDeviceAction_clicked()));
connect(deleteDeviceAction, SIGNAL(triggered()), this, SLOT(on_deleteDeviceAction_clicked()));
QHBoxLayout* pHLTop = new QHBoxLayout();
pHLTop->addWidget(navigationMenuBar);
pHLTop->setSpacing(0);
pHLTop->setMargin(0);
this->setTopbarLayout(pHLTop);
//成员信息
QPixmap pixmapLeft(ImagePath::USER_PORTRAIT);
QPixmap pixmapRight(ImagePath::RIGHT_HOLLOW_ARROWS);
btnUserDetail = new GroupButton(this);
btnUserDetail->setPixMap(pixmapLeft);
btnUserDetail->setReserve(pixmapRight);
btnUserDetail->setAttribute(Qt::WA_LayoutUsesWidgetRect);
btnUserDetail->setFixedHeight(this->screenHeight()*0.12);
btnUserDetail->setStyleSheet(SheetStyle::GROUPBUTTON_BOTTOMBORDER);
connect(btnUserDetail, SIGNAL(clicked()), this, SLOT(on_btnUserDetail_clicked()));
//成员所属设备列表
devListWidget = new GListWidget(this);
this->setGListWidget(devListWidget);
connect(devListWidget, SIGNAL(flexClicked(int)), this, SLOT(on_btnListWidgetFlex_clicked(int)));
//主体布局
QVBoxLayout* vbLayout = new QVBoxLayout;
vbLayout->addWidget(btnUserDetail);
vbLayout->addSpacing(this->screenHeight()*0.037);
vbLayout->addWidget(devListWidget);
vbLayout->setSpacing(0);
vbLayout->setMargin(0);
vbLayout->addStretch(0);
this->setBodyPartLayout(vbLayout);
curFixedContentHeight += this->screenHeight()*0.037;
//屏幕触摸滚动设置
this->installScrollViewportArea();
this->loadLocalData();
timerID = this->startTimer(ConstNum::MAX_TIME_INTERVAL);
}
示例2: MenuBar_addAction
/** void QWidget::addAction(Action *action)
* bind/QWidget.h:37
*/
static int MenuBar_addAction(lua_State *L) {
try {
MenuBar *self = *((MenuBar **)dub_checksdata(L, 1, "mimas.MenuBar"));
Action *action = *((Action **)dub_checksdata(L, 2, "mimas.Action"));
self->addAction(action);
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "addAction: %s", e.what());
} catch (...) {
lua_pushfstring(L, "addAction: Unknown exception");
}
return dub_error(L);
}