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); }
/** 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); }